ServiceStack Ormlite和RowVersion支持 [英] ServiceStack Ormlite and RowVersion support
问题描述
在更新过程中支持sql server rowversion的最简单方法是什么?
What is the easiest way to support sql server rowversion during update?
我尝试过:
db.UpdateOnly(u, f => new { f.Name, f.Description, f.Modified, f.ModifiedBy }, f => f.Version == u.Version && f.Id == u.Id);
但这失败了,因为它将版本与Varchar(8000)
进行了比较,如图.
but that fails miserably because it compares version as a Varchar(8000)
, go figure.
不完全相同,但仍然是ServiceStack和OrmLite问题:
Not exactly the same but still a ServiceStack and OrmLite question:
渴望获得与负载相关的实体描述的最佳方法是什么?我已经看到了,但注意到Join
变更集正在签入?这导致POCO类现在对每个外键都有附加的已忽略"描述.
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.
推荐答案
由于RowVersion是byte[]
字段,因此它需要对Updates/Insert进行参数化支持,其中
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.
Join
支持是我们计划添加到OrmLite的新Expression生成器的一部分,它尚未准备好.对于急切的加载,您可以使用自定义SQL,也可以根据您的查询使用Linq2Objects在内存中加入结果集.
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.
这篇关于ServiceStack Ormlite和RowVersion支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!