tag:blogger.com,1999:blog-4394562672296169849.post189362238630028835..comments2023-12-21T18:06:15.136+08:00Comments on class Programmer : IEnableMuch {: NHibernate saves your whole object graph even on cross-process scenario. NHibernate+WCFIEnableMuchhttp://www.blogger.com/profile/01393635235961303977noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-4394562672296169849.post-37217637479283404172014-04-23T21:10:34.440+08:002014-04-23T21:10:34.440+08:00Nice write up. Extra points for using some generi...Nice write up. Extra points for using some generic-well-known domain objects, not something specific to your domain. <br /><br />Here is the EF (Entity Framework) d@gger. No .Merge in EF is a deal breaker.<br /><br />http://msdn.microsoft.com/en-us/library/ee373856.aspx<br /><br />If you are using POCO entities without proxies, you must call the DetectChanges method to synchronize the related objects in the object context.<br />-->> If you are working with disconnected objects you must manually manage the synchronization. <<--<br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4394562672296169849.post-28413932328479693682013-11-18T21:19:07.283+08:002013-11-18T21:19:07.283+08:00I concur it's better to use delta especially i...I concur it's better to use delta especially if the bandwidth is constrained. This post just show that it's possible to send an object graph to NHibernate with ease. An object graph could also carry delta instead of sending the entire graph. Time permitting, I will make a POC on thatIEnableMuchhttps://www.blogger.com/profile/01393635235961303977noreply@blogger.comtag:blogger.com,1999:blog-4394562672296169849.post-14598621090163509912013-11-18T13:13:17.741+08:002013-11-18T13:13:17.741+08:00I think another approach is better than the one he...I think another approach is better than the one here. Instead of sending the entire modified object graph over the wire, why not instead just send the delta? You wouldn't even need generated DTO classes in that case. If you have an opinion about this either way, please let's discuss is at http://stackoverflow.com/questions/1344066/calculate-object-delta .Adrian Alexander Pinterhttps://www.blogger.com/profile/03189159591463976343noreply@blogger.comtag:blogger.com,1999:blog-4394562672296169849.post-44012769792956105812013-09-18T02:59:14.139+08:002013-09-18T02:59:14.139+08:00Thanks a lot for your quick answer! I think this i...Thanks a lot for your quick answer! I think this is a "bug" on NHibernate, so (IMHO) it should be fixed since there are a lot of people using that method. Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4394562672296169849.post-12803306401759011362013-09-11T20:18:22.544+08:002013-09-11T20:18:22.544+08:00I encountered the same problem, I don't know w...I encountered the same problem, I don't know why NHibernate team opted to do writes in that sequence. When I tried to mimic NHibernate's Merge functionality on Entity Framework, I made the merge functionality do the writes in this sequence: DELETE, UPDATE, INSERT to avoid "already" exists problem<br /><br />Line 569: <br />https://github.com/MichaelBuen/ToTheEfnhX/blob/master/Ienablemuch.ToTheEfnhX.EntityFramework/EfRepository.cs<br /><br /><br />I'm inclined to modify NHibernate to do writes in proper sequence, so that kind of problem will not happen. I think it can be requested on NHibernate team :-)IEnableMuchhttps://www.blogger.com/profile/01393635235961303977noreply@blogger.comtag:blogger.com,1999:blog-4394562672296169849.post-86376005950013953002013-09-10T23:59:08.038+08:002013-09-10T23:59:08.038+08:00Great article!. I just want to comment something. ...Great article!. I just want to comment something. I have a problem by using Merge method because I have a unique key in a relation table. My model is the following: Order, OrderItem and Product. 1 Order has many OrderItem and 1 OrderItem belongs to 1 Product. OrderItem has a unique key composed by "OrderId, ProductId", and when the User deletes and re-inserts items on the client-side application with a ProductId that "already" exists in the same Order and then call Merge method it throws a unique key exception. Apparenttly NHibernate is trying to execute the insert before delete...does anyone have an idea/clue/workaround how to fix this problem?<br /><br />Thanks in advance! Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4394562672296169849.post-62028244085398947332013-07-04T12:09:48.489+08:002013-07-04T12:09:48.489+08:00I'm starting to hate Entity Framework.I'm starting to hate Entity Framework.Shimmyhttp://blogs.microsoft.co.il/blogs/shimmynoreply@blogger.com