Mapping Composite keys in Fluent NHibernate

fluent-nhibernate

I am new to Fluent NHibernate and have been unable to figure out how to map composite keys.

How can I do this? What approach do I need to take?

Best Answer

There's a CompositeId method.

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