I have created a solution in Visual Studio to attempt to implement a basic 3-Tier C# Application. I’ve researched this concept and now I am trying to put it together using different projects for each Tier i.e I have projects for DataAccess, BusinessRules and BusinessObjects.
Should the BusinessRules project contain references to the DataAccess and BusinessObject projects? (And DataAccess and BusinessObjects should not reference BusinessRules?)
After setting this up, I realised although I understand what each layer is responsible for, I didn’t know if you should populate a Business Object(s) with data in the DataAccess layer, or whether the DataAccess Layer should pass the requested data to the BusinessRules and then populate the objects – what is the recommended way of doing this?
While it probably doesn’t help with your question, the answer will always be “It depends.” There is no “one ring to rule them all” when it comes to this. If there were, architects wouldn’t be needed.
That being said, in my particular case I like to:
Again, those items work in my case. They could be completely wrong for you. Also, you didn’t mention a user interface layer, a service layer, a blah blah layer, etc. There can be a lot of pieces and parts.
There aren’t any hard rules that you must follow to be correct. You have to look at your needs, your requirements, and what constraints you have.
Good luck.