[英]FluentNHibernate Formula Mapping C#
Is there a way to declare a map passing a Formula which will run just for a specific statement ( SELECT
in my case) ? 有没有办法声明一个传递公式的映射,该公式将仅对特定语句运行(在我的情况下为
SELECT
) ?
The problem is that I have something like 问题是我有类似
Map(x => x.Id).Formula("SUBSTRING(id, 0, 2)");
But it's causing errors when I try to run an insert for this specific entity, because it's using the Formula
for the insert statement as well. 但是,当我尝试为该特定实体运行插入时,这会导致错误,因为它也在插入语句中使用了
Formula
。
We have to make such column readonly 我们必须将此类列设为只读
Map(x => x.Id)
.Formula("SUBSTRING(id, 0, 2)")
.ReadOnly();
or more like original insert="false" udpate="false"
或更像原始的
insert="false" udpate="false"
Map(x => x.Id)
.Formula("SUBSTRING(id, 0, 2)")
.Not.Update()
.Not.Insert();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.