Have a DLL with all the database related code (data tier). I personally use Entity Framework but the choiche here is up to you.
Have another DLL with the business rules. This is your mid tier, all data passes through here. There is no direct communication between the data layer and the UI layer. This tier takes care of data validation, calculations and so forth, and uses the data
tier the retrieve and store data.
Have you MVC project, which references the business layer and uses its public methods.
Tie all together using an abstraction layer where you define the interfaces, and implement them in the data tier and business tier.
Then you can go to more advanced levels, like using IoC to inject the data tier in the business tier, etc.
Sgro
Participant
782 Points
352 Posts
Re: Repositories, Services, ... Need Advice. Thank You.
Apr 03, 2009 07:16 AM|LINK
I can tell you my approach:
Have a DLL with all the database related code (data tier). I personally use Entity Framework but the choiche here is up to you.
Have another DLL with the business rules. This is your mid tier, all data passes through here. There is no direct communication between the data layer and the UI layer. This tier takes care of data validation, calculations and so forth, and uses the data tier the retrieve and store data.
Have you MVC project, which references the business layer and uses its public methods.
Tie all together using an abstraction layer where you define the interfaces, and implement them in the data tier and business tier.
Then you can go to more advanced levels, like using IoC to inject the data tier in the business tier, etc.
Web Developer
IWA Member