ServiceStack Ormlite and RowVersion support

岁酱吖の 提交于 2019-12-24 00:43:27

问题


What is the easiest way to support sql server rowversion during update?

I tried this:

db.UpdateOnly(u, f => new { f.Name, f.Description, f.Modified, f.ModifiedBy }, f => f.Version == u.Version && f.Id == u.Id);

but that fails miserably because it compares version as a Varchar(8000), go figure.

Not exactly the same but still a ServiceStack and OrmLite question:

What is the best way to eager load related entity descriptions? I've seen this but noticed the Join changeset being checked in? This has lead to the POCO classes now having additional "Ignored" descriptions for each of the foreign keys.


回答1:


As RowVersion is a byte[] field, it requires a parameterized support for Updates / Insert which have been added to ServiceStack.OrmLite in v3.9.37.

The Join support is apart of a new Expression builder we're planning on adding to OrmLite, it's not ready yet. For eager loading you can use custom SQL or depending on your query you may be able to join the result sets in-memory using Linq2Objects.



来源:https://stackoverflow.com/questions/14761830/servicestack-ormlite-and-rowversion-support

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