Quantcast
Channel: patterns & practices: Project Silk
Viewing all articles
Browse latest Browse all 93

New Post: Models in different layers

$
0
0
Hi,

Based on my understanding, the models located at MileageStats.Model are simple models representing the entities of the data base, and are used to retrieve and store the data in it thought Entity Framework. Meanwhile, the models located at MileageStats.Domain are the ones used by the controllers and views in the application, which also implement logic regarding the data they contain, like validation, etc. The application transforms one model into the other and backwards when passing information between layers (for example, the User model is converted in the UserService class.)

With that being said, I believe this architecture was implemented mostly based on a design decision, like separating the validation logic from the data access layer or decoupling the controllers / views from the underlying data base schema (while the models in MileageStats.Model can be mapped to the data base, this does not apply to some models in MileageStats.Domain.)

However, design decisions are often different for each application, so this design is not a must for every scenario.

I hope this helps,

Damian Cherubini
http://blogs.southworks.net/dcherubini

Viewing all articles
Browse latest Browse all 93

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>