3

I setup a solution with the following structure:

  • Project.Core

    • Domain

    • Mappings

    • Repositories

  • Project.Web

    • Views

    • Models

    • Contollers

Project.Web is the asp.net MVC 3 template. I was wondering what would be the best architecture would be if i'm using MVC and NHibernate and I wont other web applications to utilize the Project.Core library.

It seems like the Domain and the Models are pretty much the same thing?

If I want to use the Domain's instead of the model how would I modify the asp.net mvc3 project to accept this?

Thanks

1 Answer 1

1

Yes, your domain objects in Project.Core are the same as your models. Just delete your Models folder in Project.Web and create a project reference from Project.Web to Project.Core. Since Project.Core is simply a Class Library project and contains your domain model, repositories, and mappings*, you can use these classes from Project.Web, a console app, web service, or any other code.

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks James. I liked the recent presentation you gave on NHibernate 3.
in mvc, the Model should be the data context of the view, i don't think it should be mixed with the domain objects.
Yeah I prefer not to call this a model but instead a ViewModel or a PresentationModel which make the distinction between them and domain objets.
We can't use data annotations , eg [Required] if we place the models in project.core.Am I right? or can it be done?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.