本文介绍了一对一流利的nhibernate?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有可能用流利的nhibernate做一对一的映射?我有以下作为一个hbm的一部分,我想转换成流利的:
< one-to-one name =Personproperty-ref =FileDataconstrained =true/>
我看到 OneToOnePart< OTHER>
in代码,但我不知道如何或如果这是用来完成此。
谢谢!
pre $ code map =>< / p> map.HasOne(x => x.Person)
.PropertyRef(x => x.FileData)
.Constrained();
我想这就是您要找的。 p>
Is it possible yet to do a one-to-one mapping with fluent nhibernate? I have the following as part of an hbm that I'm trying to convert to fluent:
<one-to-one name="Person" property-ref="FileData" constrained="true"/>
I see a OneToOnePart<OTHER>
in the code but i'm not sure how or if this is used to accomplish this.
Thanks!
解决方案
There is a HasOne mapping
map => map.HasOne(x => x.Person)
.PropertyRef(x => x.FileData)
.Constrained();
I think that's what you're looking for.
这篇关于一对一流利的nhibernate?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
08-15 20:26