MikaelEliasson / EntityFramework.Utilities

Provides extensions for EntityFramework that doesn't exist out of the box like delete and update by query and bulk inserts
443 stars 175 forks source link

EFBatchOperation.InsertAll "Sequence contains no element" #76

Open ms92ita opened 8 years ago

ms92ita commented 8 years ago

Hi,

I have found this issue when i was trying to call InsertAll function. The error thrown was "Sequence contains no element" at row 192 of MappingHelper, when withCondition doesn't have elements tableMapping.TPHConfiguration = new TPHConfiguration { ColumnName = withConditions.First().Fragments[0].Conditions[0].Column.Name, Mappings = new Dictionary<Type, string>() };

IMHO this error occurs when the model has a related inheritance, but the inheritance type is not of TPH pattern, but for example a TPT inheritance. I have written my context in code-first mode and, for some needs, i have to implement this inheritance. I have downloaded the source code and, at the moment, I have modified the code so as I will use the library anyway (i have only checked if withConditions has elements), but if anyone who knows better EF model mapping has a solution for this problem, this is appreciated.

Thanks is advance

miguelcaravantes commented 8 years ago

i have same issue