I'm using EF6 with Oracle via ODP.NET. And I need (and I can't change it) that all db objects would be in uppercase.
I added some conventions and now I have all tables, columns, foreign keys etc in uppercase. All but Discriminator column that generated by EF for two TPH hierarchies.
My question is how I can tell EF to rename this column? I know the way with Requires(...).HasValue(...)
syntax but I don't want to specify discriminator value for every type (and for every new hierarchy in future). I satisfied with default values, just want to rename column itself.
Following convention solved my problem (found here):
public class UpperCaseDiscriminatorConvention : IStoreModelConvention<EdmProperty>
{
public void Apply(EdmProperty property, DbModel model)
{
if (property.Name == "Discriminator")
{
property.Name = "DISCRIMINATOR";
}
}
}