locked
domain models and MVC model RRS feed

  • Question

  • User65893105 posted

    Im building an app and trying to implement 'proper' separation of concerns.  In my solution I have a 'Core' project that contains my domain model, an MVC (4) project, an infrastructure project and a repositories project.  The repositories project contains the .edmx file created against an existing database.  Ive separated out the POCOs that the .tt generator created and put them into the domain model project.  As the MVC solution has also generated a Model folder, is it better practice to remove this folder and use the domain model instead ?  Obviously my models have behaviour as well as just properties so would extension methods be best here or would I be better off keeping the models in the MVC project and creating new model classes here inheriting from the domain model classes then adding any behaviour to these new models classes ?  I hope I make sense, its just I cant see why I would need 2 'Models' in my solution and as Im trying to learn the 'correct' way to architect a system I want to make sure Im going about it the best way.

    Thursday, March 14, 2013 8:17 AM

Answers

  • User197322208 posted

    yes for automapper

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 14, 2013 7:41 PM

All replies

  • User197322208 posted

    is it better practice to remove this folder and use the domain model instead ?

    yes

    Thursday, March 14, 2013 11:53 AM
  • User65893105 posted

    what about functionlity within the model ?  I could regenerate these pocos  many times after changing the database (its a database first model) would extension methods be good practice or should I create a new model class and inherit from the domain class and add the functionality to the new class (view model classes ?)

    Thursday, March 14, 2013 1:00 PM
  • User65893105 posted

    Ive also seen automapper being used that maps from the view model to the poco domain model, is this a good approach ?

    Thursday, March 14, 2013 1:02 PM
  • User197322208 posted

    yes for automapper

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 14, 2013 7:41 PM