我正在使用Breeze和Web API以及NHibernate。以下NHibernate映射类型(可能很少使用)导致Breeze错误消息"不是关联"在NHMetadataBuilder类的方法MakeAssociationProperty中:
<set name="Zugnummern"
table="USER_ZUGNUMMER_T"
lazy="true"
cascade="save-update">
<key column="USER_ID" />
<element column="TRAIN_NO"
type="string"
length="6"
not-null="true"
unique="false" />
</set>
如何在这个特殊的NHibernate映射中使用Breeze?
答案 0 :(得分:0)
通过检查collectionPersister
ManyToMany
OneToMany
方法中的BreezeContextProvider.NH
是NHMetadataBuilder.MakeAssociationProperty
还是// inverse foreign key
var collectionPersister = joinable as AbstractCollectionPersister;
if (collectionPersister != null)
{
if (collectionPersister.IsManyToMany || collectionPersister.IsOneToMany)
{
// many-to-many relationships do not have a direct connection on the client or in metadata
var elementPersister = collectionPersister.ElementPersister as AbstractEntityPersister;
if (elementPersister != null)
{
fkNames = GetPropertyNamesForColumns(elementPersister, columnNames);
if (fkNames != null)
nmap.Add("invForeignKeyNamesOnServer", fkNames);
}
}
}
,可以防止“非关联”异常对于属性“Zugnummern”的上述样本集映射,条件将为false:
{{1}}