I have a base class Company
and two derived classes Retailer
and Supplier
.
I had to add an enum to the Retailer
class but now when I try to create a new Supplier
I get the following SQL error:
Cannot insert the value NULL into column 'OperatingStatus', table 'Company'; column does not allow nulls. INSERT fails. The statement has been terminated.
In case it helps, here are the classes and the enum:
public abstract class Company
{
...
}
public class Retailer : Company
{
public OperatingStatus OperatingStatus { get; set; }
...
}
public class Supplier : Company
{
...
}
public enum OperatingStatus
{
Unknown = 0,
Active = 1,
Inactive = -1
}
Is there a way to make this work without moving the enum to the base class? All I need is to make it defaults to 0
.