Enum properties in subclasses are not recognized when TPH mapping is utilized. This seems to be due to the fact that the FindSchemaMappingFragment in MetadataHander returns null when a child entity type is encountered. I will change to TPT mapping strategy as a workaround.
public abstract class Furniture
{
public int Id { get; set; }
public Pattern Pattern { get; set; }
}
public class Bed : Furniture
{
public MattressType Mattress { get; set; }
}
[Flags]
public enum MattressType
{
Soft = 1,
Firm = 2
}
[Test]
public void FindsReferences_InChildEntityType_TPHMappingStrategy()
{
IList<EnumReference> references;
using (var context = new MagicContext())
{
references = _enumToLookup.FindEnumReferences(context);
}
var mattress = references.Count(r => r.EnumType == typeof(MattressType));
Assert.AreEqual(1, mattress, "Wrong number of Mattress refs found");
}
Enum properties in subclasses are not recognized when TPH mapping is utilized. This seems to be due to the fact that the FindSchemaMappingFragment in MetadataHander returns null when a child entity type is encountered. I will change to TPT mapping strategy as a workaround.