Hi, This is a bit of conceptual questions but I think it’s the right place to ask it.
i am working with NHibernate for some time but I find it difficult to use the collections within the POCO objects 1. I think the proxy concept is nice but when you want o use it in multi tier architecture it become a challenge. 2. I want to add a business logic on any type of request from the DB. for example authorization restrictions etc.. 3. i would like to add some business logic when i add or remove entity from a collection.
and there are some more reasons why i have problems with the collections and proxies.
i thought maybe there is a way to use the POCO object without any collections and let the service layer to handle sub queries and association etc... i understand that the collection are needed for the Nhibernate to work but once i am out of the service layer i want to flat the objects and take out all the collections. this way i can implement my own operations and business logic.
is there any standard way to do it? do i need to attach and detach the objects? how do i create DTO object from the POCO object and copy the fields etc...
anyone have some best practices for that and did the same?
I which I could just create the POCO objects without any relationship and only let nhibernat know about those relationships via the mapping. then using the session i can control the associations between the objects.
Thanks, Noam