I am trying to use CompositeId to map to a legacy system. The source database has a composite primary key so I can't use the normal this.Id mapping.
Here is my attempt to map it:
public PriorityListPartMap()
{
this.Schema("EngSchedule");
this.Table("vPriorityListPart");
this.CompositeId().KeyProperty(x => x.AssemblyPartNumber).KeyProperty(x => x.PartNumber);
this.Map(x => x.CurrentDueDate);
this.Map(x => x.OrderLine);
this.Map(x => x.OrderNumber);
this.Map(x => x.PartDescription);
this.Map(x => x.ProductCode);
this.Map(x => x.Revision);
}
When I try to create the session factory this mapping causes the error: Could not compile the mapping document: (XmlDocument)
I tried removing the CompositeId mapping and replaced it with:
this.Id(x => x.AssemblyPartNumber).GeneratedBy.Assigned();
The error goes away with that mapping but I can't really use that since the AssemblyPartNumber is not unique.
Is there a different way to map to a table with a composite primary key?
Thanks,
Matthew MacFarland