Where should I place additional classes in my MVC application?

I have an ASP.NET MVC application that uses the Linq to SQL classes placed in the Model folder.

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

In WebForms, I will have DAL as class library. My BLL is like a class library that referenced my BLL. My website is referenced by both DAL and BLL.

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

If I then add (or try to add) a link to my class library, I end up with a circular dependency.

In web forms. My other option would be to place the classes in App_Code. Is there an equivalent to App_Code in an MVC app?

0


a source to share


4 answers


You can move all your models to a class library, can't you? Neither MVC nor VS is crazy. This will remove the model library dependency in the web application.



+2


a source


You can put this in the model folder. Since all business related classes are placed in this folder



For best practice see scottgu nerddinner . He created breathing classes in the nerdinner app.

+2


a source


I agree with the Model folder . You can arrange it for your heart (BLL, DAL, etc.).

I personally would avoid doing a separate build unless you have a good reason. I am a developer who tends to complicate problems too much, if I am not careful I try to follow the KISS (Keep It Simple Stupid) methods as much as possible, which usually does not allow me to get rid of a certain problem.

+1


a source


Try taking a look at the S # arp architecture. You can use the template they provide or use it as a reference to help you make decisions.

http://code.google.com/p/sharp-architecture/

+1


a source







All Articles