在Fluent NHibernate中映射复合键 [英] Mapping Composite keys in Fluent NHibernate

查看:128
本文介绍了在Fluent NHibernate中映射复合键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的流利的NHibernate。现在我面临着复合键映射的一个问题。
任何人都可以指出的URL或示例吗?

解决方案

有一个 CompositeId 方法。

  public class EntityMap:ClassMap< Entity> 
{
public EntityMap()
{
CompositeId()
.KeyProperty(x => x.Something)
.KeyReference(x => ; x.SomethingElse);
}
}


I am new to fluent NHibernate. Now I face one problem with mapping composite keys. Can anyone point out the URL or sample please?

解决方案

There's a CompositeId method.

public class EntityMap : ClassMap<Entity>
{
  public EntityMap()
  {
      CompositeId()
      .KeyProperty(x => x.Something)
      .KeyReference(x => x.SomethingElse);
  }
}

这篇关于在Fluent NHibernate中映射复合键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆