EntityFramework.Utilities
EntityFramework.Utilities copied to clipboard
Error in MappingHelper when IsHierarchyMapping=true, but no Conditions
I'm using the utility on EF 6.1.3 and Model First.
In the function EfMapping(DbContext db)
if (mapping.EntityTypeMappings.Any(m => m.IsHierarchyMapping)) is true
But
var withConditions = mapping.EntityTypeMappings.Where(m => m.Fragments[0].Conditions.Any()).ToList();
is empty.
So the next step crashes on ColumnName = ....
tableMapping.TPHConfiguration = new TPHConfiguration
{
ColumnName = withConditions.First().Fragments[0].Conditions[0].Column.Name,
Mappings = new Dictionary<Type, string>()
};
I resolved this by adding the following before this
if (withConditions.Any())
{
I don't know the couse of the empty list. We don't use TPH, Just normal ForeighnKey relation.
The same error
The same error!