timabell / ef-enum-to-lookup

Generates lookup tables from enum references in Microsoft Entity Framework 6.1
https://www.nuget.org/packages/ef-enum-to-lookup
69 stars 29 forks source link

0 matches found for property .... #59

Open ADringer opened 7 years ago

ADringer commented 7 years ago

Hi,

I've added the following code to the seed method (as per the docs):

var enumToLookup = new EnumToLookup(); enumToLookup.Apply(context);

But when running it I get the exception:

0 matches found for property SolutionType

Not too sure what this means, any tips?

Thanks

dvankuren commented 5 years ago

In case anyone else runs into this, I've tracked it down to being an issue with entities represented by an abstract class that has an enum property on it. It looks like we get the mapping fragments from the derived class, which doesn't include the base class properties. I honestly didn't spend a lot of time on it because I have other commitments, but for anyone that is interested, in MetaDataHandler.FindEnumReferences, you can change:

foreach (var entityType in entities)

To:

foreach (var entityType in entities.Where(e => !e.Abstract))