Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enums in child types not recognized in TPH mapping #39

Open
prodibaugh opened this issue Aug 20, 2015 · 4 comments
Open

Enums in child types not recognized in TPH mapping #39

prodibaugh opened this issue Aug 20, 2015 · 4 comments

Comments

@prodibaugh
Copy link

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");
    }
@samitdesai
Copy link

Is this bug fixed or still open.
i run the above example and test fails.

@timabell
Copy link
Owner

Still open.

@samitdesai
Copy link

HI i am new to EF sorry if it don't make sense.
But is there any workaround to this.

@timabell
Copy link
Owner

I haven't looked into it, couldn't say.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants