Solution Structure: reference dependency references

Jan 23, 2008 at 4:43 PM
When I look at the solution structure that the GAT creates, I see references created so that the implementation sees just about everything EXCEPT Service.DataAccess. This leads me to believe the idea would be to go through the business entities/logic.

BusinessLogic sees Entities and DataAccess. But Entities sees NOTHING.

In short, while trying to trace the sequence of a data method call that will go through logic, data access, business entities, and get returned as a data contract, I'm having a hard time understanding the particular reasoning for the dependency chains. Is this documented somewhere? I could obviously start adding references left and right, but I'm not high on changing pre-defined structures on a whim. I tend to assume there is a REASON for the dependency hierarchy.

So if I want to pass a type that is defined in a businessEntities back to a layer that doesn't REFERENCE businessEntities, I see a problem.



Jan 23, 2008 at 5:46 PM
Edited Jan 23, 2008 at 5:54 PM
I too had questions about this. I resolved myself to something similar to:

Host gets a request
Host calls ServiceImplemenation
ServiceImplemenation calls static function in BusinessLogic to get BusinessEntity Object.
BusinessLogic (after a reference to Microsoft.Practices.Repository is added) has repositoryfactory create your repository
BusinessLogic creates a BusinessEntity object
BusinessLogic calls your repository to retrieve your data and assigns this return to the BusinessEntity
BusinessLogic returns the BusinessEntity to ServiceImplemenation
ServiceImplemenation creates a DataContract object.
ServiceImplemenation translates the BusinessEntity to DataContract and assigns this to the DataContract object
ServiceImplemenation creates a new response message
ServiceImplemenation assigns the DataContract object to the return property of the response
ServiceImplemenation returns the response

Yeah, I know, not exactly what you were looking for, but that is how I resolved this in my head without driving myself mad and I only added one reference. I guess now looking at this, the DataAccess could create an implementation class to return the IProductsRepository object, then you would not have to add the reference in BusinessLogic.