Nhibernate中的多个主键?

时间:2011-11-23 17:10:47

标签: nhibernate orm mapping

如何在NHibernate中映射时分配多个主键?

    Id(x => x.TopicID); <<----Primary Key
        Map(x => x.Topic);   <<---Should Also be a Primary Key
        Map(x => x.Subtitle);
        Map(x => x.Description);
        Map(x => x.ImageURL);

    }

1 个答案:

答案 0 :(得分:0)

使用CompositeID方法:

CompositeId()
.KeyProperty(x => x.TopicId, "name")
.KeyReference(x => x.Topic, "anotherName");