Using complex types the default column naming convention uses underscore. That means having type defined that way:
[ColmplexType]
public class Contact
{
I've never done this before but it's worth trying the ComplexTypeAttributeConvention
, you can remove the default one and add the custom one to DbModelBuilder.Conventions
:
public class CustomComplexTypeAttributeConvention : ComplexTypeAttributeConvention {
public CustomComplexTypeAttributeConvention(){
Properties().Configure(p => p.HasColumnName(p.ClrPropertyInfo.Name));
}
}
protected override void OnModelCreating(DbModelBuilder modelBuilder){
modelBuilder.Conventions.Remove();
modelBuilder.Conventions.Add(new CustomComplexTypeAttributeConvention());
//...
}