Open americanslon opened 6 years ago
any update on above?. One of the column in entity is different from table and fluent map exist in solution.
I managed to fix this by using the property mapping. I've updated the column name.
var m = EfMappingFactory.GetMappingsForContext(this.contextx as DbContext).TypeMappings[typeof(Customer)];
var table = m.TableMappings.First();
table.PropertyMappings.ForEach(property =>
{
if (property.PropertyName == "Id")
{
property.ColumnName = "ID";
}
});
@DEV-MAX It sounds like the casing of the ID column in the database does not match with the casing of the Id column in your EF model. Unless you are using [Column("ID")]
or HasColumnName("ID")
to configure this discrepancy in your EF model, EFUtilities is not going to be able to properly map your entities.
@DEV-MAX It sounds like the casing of the ID column in the database does not match with the casing of the Id column in your EF model. Unless you are using
[Column("ID")]
orHasColumnName("ID")
to configure this discrepancy in your EF model, EFUtilities is not going to be able to properly map your entities.
Yeah, EF is case insensitive when it comes to column name, so I didn't defined the column mapping initially. Now I defined the HasColumnName and it's working . Thank you
In my project I use bulk insert on five different entities in the same. 4 work , while the 5th one fails with the above error. I don't even know where to start debugging this, as the above error is all I get.
This is a code first EF 6.2.0 application.
This is how I use it
List<Rule> list = new List<Rule>(); ... EFBatchOperation.For(context, context.Rules).InsertAll(list);