There are some interesting architectural questions posed by this question and ones that I am also working to solve myself at the moment
Reading some NHibernate papers the recommendations seems to be to isolate NHibernate in a Data Access Layer and to try not to expose NHibernate internals to the business lgic and GUI layers.
Trying to comply with the abvoe, my Data Access Layer is accessed via a factory which provides DAO objects for each core business entity to be persisted. Collections are provided (Generics), one for each of the core business objects, these collections implement BindingList so they can be directly bound to user controls. The idea is that these collections may also be extended if necesary to provide basic sorting and filtering operations etc as required which I believe are not available as standard with the BindingList. Currently my collections contain the business objects that are to be persisted but it could also be at a later date I could decide that the buainess objets are in fact courser grained objects than those that are persisted via NHibernate. However this is not the case at the moment
With this approach I am hoping to acheive a clear layering within the applicaiton e.g seperate, GUI, Business Lgic and Data Access layers.
I have just started on this approach so I am interested in feedback from anyone who has already travelled this route and can provide some recommendations in architecting solutions uisng NHiberante with C# GUI's.
TIA
Steve
|