简体   繁体   中英

How to map composite foreign key to a non-primary unique key in FluentNHibernate?

I need to map a legacy db that has composite foreign keys referring to non-primary unique keys.

First, I was trying to map it in EntityFramework. Unfortunately, I have found that EntityFramework (or at least 5.0) does not support that .

Now, I am trying to achieve that in NHibernate (with fluent mapping). However, I am unable to find any examples in the docs . Neither I have found that among the unsupported features .

Does NHibernate support that? Are there some samples or docs?

使用CompositeId方法创建复合键。

CompositeId().KeyProperty(x => x.Property1).KeyProperty(x => x.Property2);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM