Is it possible to add my own convention to Entity Framework 4.3?
It was possible before version 4.1, like this
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
modelBuilder.Conventions.Add<UppercaseColumnNameConvention>(); // Own convention
}
But after v4.1 Add method is internal.
I need all my columns in the database to be uppercase without changing POCO objects and, if it is possible, without using attributes. b/o there a lot of entities and this would be very hard to rename all fields or add attribute [Column("UPPERCASENAME")].
Pluggable conventions are not supported at the moment. This thread Pluggable Conventions in Entity Framework still holds. You could configure column names with HasColumnName() method in the OnModelCreating method. If you don’t want to do it manually, you could automate it (e.g. using reflection) and do this for all entities in your model. Yes, it’s far from ideal.