This site provided me with many useful answers, however after several hours of searching I did not find anything that specifically suits my needs. So here goes ...
The company I'm working on is in the process of designing a new level of business objects and a level of access to data - they will be placed in separate assemblies.
The problem is that it’s not easy for me to understand the interaction between these two levels - in particular, if DAL knows about BOL, I read a lot of articles that say that the order of dependencies should go something like this: this:
GUI / Presentation → BOL ---> DAL
But, as far as I see, DAL needs a reference to BOL in order to be able to "return" objects to the BOL level.
I am going to do an intermediate assembly between BOL and DAL, which will be basically a thin layer filled with interfaces to decouple the two DLLs, so this structure can use different DALs if necessary.
This led me to the idea of ​​introducing another thin layer with a bunch of interfaces that BOs implements, and then, when BOL calls the DAL interface, it passes it an object that implements one of these BO interfaces, and then DAL continues to populate the object. This removes all the dependencies between BOL and DAL — however, it’s hard for me to justify this, to be honest.
Ideally, we would like to use ORM, because it just removes the need to write CRUD materials, but our customers are in the habit of messing around with the column lengths in their database, and this is the reason for most of our errors today, using strongly typed DataTables. I heard that Linq2SQL also stores column lengths at compile time, but I'm not sure what NHibernate does or not (but I'm not sure that our database schema is designed enough for NHibernate, a trap for working with legacy systems).
So, any understanding of the relationship between BOL and DAL would be very welcome - sorry if the above is poorly written, if anyone needs clarification, I will gladly provide more detailed information.
Marlon