I’m trying to use a discriminator field in my linq to sql setup. I have a base class called Inventory_Item which I have setup to be abstract and then many different services that inherit from it (e.g. BaseWash). Now the properties for the BaseWash association are
Base Class Discriminator Value = 1 Derived Class Discriminator Value = 2 Discriminator Property = ItemCategoryID Inheritance Default = BaseWash
This builds fine but when it runs I get an exception in the designer code here:
public System.Data.Linq.Table<Inventory_Item> Inventory_Items { get { return this.GetTable<Inventory_Item>(); } }
Abstract class ‘ICS.Core.Inventory_Item’ should not be assigned an inheritance discriminator key.
What am I doing wrong?
Since
Inventory_Itemis abstract, there is no way you can ever instantiate anInventory_Item. So just clear theBase Class Discriminator Value– it can never be used. Or make the class non-abstract and leave it at 1.