EF vs Nhibernate Merge Disconnected Object Graph

两盒软妹~` 提交于 2019-12-05 09:46:20

I found that EF doesn't have auto merge, their merge capabilities so far are only manual merge, and it will work only if the Context object has in memory all the dependencies of the object.

Dealing with multilevel disconnected objects, and dealing with reconnecting them manually is a lot of work and can result in really weird and hard to handle bugs (just like the one stated in the question where new cities where created because it wasn't merged , so it just created a new one even if it had an ID)

so for now - Nhibernate wins this battle, Nhibernate has an automagic merge functionality, if your disconnected object has an ID it will try to merge it, and be successful (from my experience) It's a little more setting up to get things running compared to the EF, but it is worth the trouble.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!