Can DataObjects.NET support SQL identity columns?

限于喜欢 提交于 2019-12-10 12:22:36

问题


While there's lots to like about DataObjects.NET, I've found help resources to be a lean, and can't find a solit example of using DataObjects.NET with RDBMS generated primary keys. It would seem as though D4O won't do inserts against SQL Server unless it's in controll of the key.

Has anyone solved this in the wild?


回答1:


There is no easy way to make DO4 use IDENTITY columns - mainly, because it is designed to rely on bulk key generation (aka HiLo algorithm).

AFAIK, there are no good workarounds here. E.g. DO4 supports custom key generators, but it's pretty complex to develop one relying on IDENTITY column - in fact, it should insert fake records in bulks and remove them further (or rollback a transaction) to work. Taking into account there can be columns with unique constraints, the task becomes pretty complex.

We'll think about implementing this in future.



来源:https://stackoverflow.com/questions/2879333/can-dataobjects-net-support-sql-identity-columns

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