在 Fluent Nhibernate 中使用 Component 作为 AsMap 中的 IDictionary 索引
我目前在一个对象上有以下属性:
private IDictionary<ExampleKey,ExampleObject> example;
其中 ExampleKey 是
public class ExampleKey
{
public long KeyField1{ get; set;}
public long KeyField2{ get; set;}
}
This 与 hbm 进行映射,语法如下:
<map name="example" inverse="true" cascade="all-delete-orphan">
<key column="OwningClassID"/>
<composite-index class="ExampleKey">
<key-property type="long" name="KeyField1" column="Key1ID" access="property"/>
<key-property type="long" name="KeyField2" column="Key2ID" access="property" />
</composite-index>
<one-to-many class="ExampleObject" />
</map>
我正在尝试将所有内容更新为 Fluent,但发现映射此内容很困难。有谁知道有什么方法可以做到这一点?
谢谢斯图
I currently have the following property on an object:
private IDictionary<ExampleKey,ExampleObject> example;
where ExampleKey is
public class ExampleKey
{
public long KeyField1{ get; set;}
public long KeyField2{ get; set;}
}
This maps with hbm with the following syntax:
<map name="example" inverse="true" cascade="all-delete-orphan">
<key column="OwningClassID"/>
<composite-index class="ExampleKey">
<key-property type="long" name="KeyField1" column="Key1ID" access="property"/>
<key-property type="long" name="KeyField2" column="Key2ID" access="property" />
</composite-index>
<one-to-many class="ExampleObject" />
</map>
I'm trying to update everything to Fluent and found difficulties with mapping this. Does anyone know of any way of doing this?
Thanks
Stu
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Fluent NHibernate 尚不支持复合索引。在获得支持之前,您必须继续使用 XML。
Composite-index isn't supported in Fluent NHibernate yet. You'll have to stay with XML until the support is in there.