title: Transferring data between layers of an application
body: <p>If I have a C# application with a 5 layer architecture, much like what is presented here <a href="http://msdn.microsoft.com/en-us/library/ee658109.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ee658109.aspx</a>, and I take the strict interaction approach of allowing a layer to only interact with the layer below, I am running into trouble when getting data in my Data layer and passing that data back up to my Business layer.</p>
  
  <p>For example, if I have a business object called MyObject that is defined in my Business layer, but information needed to construct an object of type MyObject is retrieved from the database in the Data layer, my Business layer needs a reference to my Data layer in order to interact with the database.  But, my Data layer then also needs a reference to the Business layer, since that is where the MyObject definition lives and the Data layer needs to construct an object of that type from the database results and give that data back to the Business layer.  Now we have a circular dependency between the Business layer and the Data layer.</p>
  
  <p>I am wondering what the proper approach is to solve this problem.</p>
  
  <p>I have thought about using DTO objects defined in my Data layer to pass information back to the Business layer.  This would work since the Business layer is able to interact with the Data layer, but not vice versa.  It just seems like this might be an awful lot of duplicate code to basically mimic the business object definitions in the Data layer.</p>
  
  <p>I also thought about creating interfaces for all of my business objects and putting those interfaces into a separate project that both the Business layer and Data layer can interact with.  That way, I can pass instances of the interface and the only common reference between the Business layer and Data layer is the project where the interfaces are defined.  I don't see many implementations of this either.</p>
  
  <p>I am wondering what others have done to solve this problem.</p>