TPH - 面临CTP5的问题 [英] TPH - facing problem with CTP5
问题描述
下面的代码工作正常,直到我转换为CTP5,不确定我是否做错了。
public abstract class ReferenceValue
{
public 虚拟 int ReferenceValueID
{
get ;
            的设置跨度>;
  &NBSP ; }
&n bsp; public virtual string < /跨度>&NBSP;值
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; {
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ; get ;
< span style ="color:blue"> set ;
}
public virtual INT 跨度>&NBSP; ReferenceGroupID
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; {
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ; get ;
; set ;
&nbs p; }
}
// 15
public class RecordStatus : ReferenceValue
{
}
'p>
<预风格= "font-family:索拉">&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; 。modelBuilder.Entity<常见的 ReferenceValue 跨度>>()
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; .MAP<普通的。的 RECORDSTATUS 跨度>>
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;(
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NB属;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; R&NBSP; =>
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; {
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; r.Requires。(的" ReferenceGroupID" 跨度>)的HasValue (15);
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;}
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP)
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; .ToTable(的" Common.ReferenceValue" 跨度>); <无线电通信/>
我收到以下错误
(6,10):错误3032:ma中的问题从第6行开始的pping片段:映射条件成员'ReferenceValue.ReferenceGroupID',条件不是'IsNull = False'。删除ReferenceValue.ReferenceGroupID上的条件或将其从
中删除映射。
(14,10):错误3032:从第14行开始映射片段的问题:映射条件成员'ReferenceValue.ReferenceGroupID',条件不是'IsNull = False'。删除ReferenceValue.ReferenceGroupID上的条件或将其从
中删除映射。
NeoTech
您好,
使用对象模型中公开的属性EF一般不支持鉴别器(除非鉴别器条件是属性不为空)。我们可能会在将来的版本中支持这一点,但这将是对核心EF
组件的更改。
你提到它在CTP5之前工作,所以我怀疑代码实现了不同的东西,你有可能发布预转换代码吗?
~Rowan
Below code worked fine until i did conversion to CTP5, not sure if i am doing something wrong.
public abstract class ReferenceValue
{
public virtual int ReferenceValueID
{
get;
set;
}
public virtual string Value
{
get;
set;
}
public virtual int ReferenceGroupID
{
get;
set;
}
}
// 15
public class RecordStatus : ReferenceValue
{
}
modelBuilder.Entity<Common.ReferenceValue>()
.Map<Common.RecordStatus>
(
r =>
{
r.Requires("ReferenceGroupID").HasValue(15);
}
)
.ToTable("Common.ReferenceValue");
I get the below error
(6,10) : error 3032: Problem in mapping fragments starting at line 6:Condition member 'ReferenceValue.ReferenceGroupID' with a condition other than 'IsNull=False' is mapped. Either remove the condition on ReferenceValue.ReferenceGroupID or remove it from the mapping.
(14,10) : error 3032: Problem in mapping fragments starting at line 14:Condition member 'ReferenceValue.ReferenceGroupID' with a condition other than 'IsNull=False' is mapped. Either remove the condition on ReferenceValue.ReferenceGroupID or remove it from the mapping.
NeoTech
Hi,
Using a property that is exposed in your object model as a discriminator is not supported by EF in general (unless the discriminator condition is that the property is not-null). We may support this in future releases but this would be a change to core EF components.
You mentioned it worked prior to CTP5 so I suspect the code was achieving something different, any chance you could post up the pre-conversion code?
~Rowan
这篇关于TPH - 面临CTP5的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!