This question was asked here 4 years ago: EF Mapping to prefix all column names within a table I\'m hoping there\'s better handling these days.
I\'m using EF6 Fluen
With model-based code-first conventions this has become very simple. Just create a class that implements IStoreModelConvention
...
class PrefixConvention : IStoreModelConvention<EdmProperty>
{
public void Apply(EdmProperty property, DbModel model)
{
property.Name = property.DeclaringType.Name + property.Name;
}
}
... and add it to the conventions in OnModelCreating
:
modelBuilder.Conventions.Add(new PrefixConvention());