I am having trouble mapping my many to many with a attribute relationship. Much like the problem here
fluent nhibernate - Many to Many mapping with attribute
But I do not have a Primary Key on my middle class, instead it is made up of the IDs of the other two classes.
Quotation SKU Class (middle Class)
public class QuotationSKUCost : Entity
{
public virtual decimal UnitPrice { get; set; }
public virtual Quotation Quotation { get; set; }
public virtual QuotationRequestSKU QuotationRequestSKU { get; set; }
}
Quotation Class
public class Quotation : Entity
{
public virtual int Id { get; set; }
public virtual DateTime ValidUntil { get; set; }
public virtual string Data { get; set; }
public virtual ICollection<QuotationSKUCost> QuotationSKUCosts { get; set; }
}
Quotation Request SKU
public class QuotationRequestSKU : Entity
{
public virtual int Id { get; set; }
public virtual int Quantity { get; set; }
public virtual ICollection<QuotationSKUCost> QuotationSKUCost { get; set; }
}
Middle Class Mapping!!
public QuotationSKUCostMapping()
{
Table("QuotationSKUCost");
CompositeId() //need to map QuotationId and QuotationRequestSKUid as Composite key
.KeyProperty(x => x.Quotation, "QuotationId")
.KeyReference(x => x.QuotationRequestSKU, "QuotationRequestSKUId");
Map(x => x.UnitPrice);
}
The error I am getting when trying to debug is:
Could not determine type for: ORM.Entities.Quote.Quotation, ORM, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null, for columns: NHibernate.Mapping.Column(QuotationId)
EDIT: Adding Quotation Mapping
public QuotationMapping()
{
Id(x => x.Id).Column("QuotationId");
Map(x => x.ValidUntil);
Map(x => x.Data);
HasMany(x => x.QuotationSKUCosts).KeyColumn("QuotationId");
}