I’m just starting my first project in ASP.NET MVC. In my webforms experience, I would usually have a separate project dedicated to my domain layer. In here, I would have my Domain specific objects along with my NHibernate mapping files and some business logic. Most of the examples I am seeing online are putting these classes along with business logic into the Models folder on the MVC app, then calling into this from the controller. From my experience, this would seem to make it harder to move that logic into a different platform if need be. Specifically, I was thinking about the possibility of needing to move it to a webforms app if the environment dictated it. This might be a naive question, but is it better to have the Domain data in its own project, or in the Models folder?
Share
If you plan to reuse the model outside of the MVC app, a separate class library is still an acceptable setup. I do that, but leave the Models folder and put the models for my views in it.
If you would put your DAL in App_Code in a Webforms project, then I would put it in Models in your MVC project. Otherwise, keep using separate projects like you have been.