I created an interface ILookupValue that I want all lookup values to inherit from.
public interface ILookupValue
{
public bool Enabled { get; set; }
}
How can I determine if the current entitySet implements the interface so that I can set the schema for that entitySet to something other than the default?
I've tried the following, but it doesn't work:
public void Apply(EntitySet entitySet, DbModel model)
{
ILookupValue lookupCheck = entitySet.GetType() as ILookupValue;
if (lookupCheck != null) { entitySet.Schema = "lu"; }
}
Update: I've tried the following also, but get an object reference not set error.
if (typeof(ILookupValue).IsAssignableFrom(Type.GetType(entitySet.ElementType.Name))) { entitySet.Schema = "lu"; }