开发者

Assigned id usages in Nhibernate (ORM’s)

Why are assigned id’s frowned upon in the 开发者_StackOverflow社区Nhibernate world? Is there a particular disadvantage to using it?


NHiberante uses ID for caching entities in first level cache and Id is used to check if an entity is trancident or persisted. When you call SaveOrUpdate method NHibernate won't be able do determine if this entity new or it must be updated.

Also if you suddelny change ID of the entity, and save it - you can update wrong row in the data base.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜