Search code examples
asp.netasp.net-mvcclass-librarys#arp-architectureapp-code

Where should I place additional classes in my MVC application


I have an ASP.NET MVC application which is using Linq to SQL classes placed in the Model folder.

I want to create some extra classes that I would normally place in my BLL but I'm not sure how to work this with MVC.

With WebForms I would have my DAL as a Class Library. My BLL as a class library that referenced my BLL. My Web Site that referenced both the DAL and BLL.

The problem I am facing is, if I create a class library, this will need to reference my MVC Application because it will need to use the types contained in my Model.

If I then add (or try to add) a reference to my class library, I will get a circular dependency.

In Web Forms. My other option would be to place the classes in the App_Code. Is there an equivalent of App_Code in a MVC application?


Solution

  • You can move all your models to the class library, can't you? Neither MVC or VS mind. This would remove the dependency of the Models library on the Web app.