Reputation: 3142
I use scaffolding after each schema change to keep in sync model and database.
I need to expose some columns with different name at domain level then the name at database level.
For example the column COMPANY_NAME in the table COMPANY_PROFILE at domain level needs to be changed in WorkingCompany
and COMPANY_PROFILE be translated in the class Company
Moreover I don't want to lose any changes every time I run the scaffolding
Upvotes: 0
Views: 888
Reputation: 307
Use CodeFirst configurations.
public class CompanyConfiguration: EntityTypeConfiguration<Company>
{
public CompanyConfiguration()
{
this.ToTable("COMPANY_PROFILE");
this.Property(p => p.WorkingCompany)
.HasColumnName("COMPANY_NAME");
}
}
Upvotes: 1