I have the following class/entity:
public class Product : ISaleable
{
public void ProcessSale()
{
return;
}
[NotMapped]
private int id { get; set; }
[NotMapped]
private string productName { get; set; }
[NotMapped]
private decimal price { get; set; }
[NotMapped]
private TaxClass taxClass { get; set; }
[NotMapped]
private int quantity { get; set; }
[NotMapped]
private Member memberAssociation { get; set; }
public TaxClass TaxClass
{
get
{
return this.taxClass;
}
set
{
this.taxClass = value;
}
}
public int Quantity
{
get
{
return this.quantity;
}
set
{
this.quantity = value;
}
}
public string ProductName
{
get
{
return this.productName;
}
set
{
this.productName = value;
}
}
public decimal Price
{
get
{
return this.price;
}
set
{
this.price = value;
}
}
public Member MemberAssociation
{
get
{
return this.memberAssociation;
}
set
{
this.memberAssociation = value;
}
}
[Key]
public int ID
{
get
{
return this.id;
}
set
{
this.id = value;
}
}
}
As you can see, this class inherits from ISaleable and has two elements of the type TaxClass. Now when the project is ran, and EF tries to create the table for this entity I get the following exception:
Column names in each table must be unique. Column name 'TaxClass_ID' in table 'Product' is specified more than once.
I am not sure why this is happening, any help appreciated.