在我的地图中,我有:
Component(
x => x.ExposureKey,
m => {
m.Map(x => x.AsOfDate).Not.Nullable();
m.Map(x => x.ExposureId).Length(30).Not.Nullable();
}
).Unique();
HBM 的相关输出是
<component name="ExposureKey" insert="true" update="true" optimistic-lock="true" class="Some.Namespace.CreditExposureKey, Some.Namespace, Version=0.0.0.0, Culture=neutral, PublicKeyToken=aaaaaaaaaaaaaaaa">
<property name="AsOfDate" type="System.DateTime, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<column name="AsOfDate" not-null="true"/>
</property>
<property name="ExposureId" type="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<column name="ExposureId" length="30" not-null="true"/>
</property>
</component>
定义中显然缺少这unique="true"
一点component
。
为什么会这样?