I have a table with 2 columns as PK (composite primary key).
How can I map them to "Id" in hbm.xml
?
<id name="A" />
How can I do it with fluent nhibernate?
The NHibernate documentation describes how to use and map a composite-id.
You can also use a component as compositeid.
And for Fluent NHibernate:
public class ClassNameMap: ClassMap<ClassName>
{
public ClassNameMap()
{
CompositeId().
.KeyReference(x => x.A, "A")
.KeyReference(x => x.B, "B");
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With