2
votes

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?

1

1 Answers

0
votes

Use the CompositeId method to create composite keys.

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