Relative Content

Tag Archive for c#asp.netentity-frameworkentity-framework-6.net-4.8

Change EF6 auto generated names of navigation properties

I have a .NET 4.8 web application with Entity Framework 6 (EF6).
When scaffolding the database model using “Code First From Database” wizard it automatically generates navigation properties for foreign key relationships.
Now, I have this kind of situation:
There a Customer table that has 2 control field named LastUpdateOperatorId and CreationOperatorId that store in line the Id of the Operator that created the record and then, at every update, it stores the Id of the Operator that edited that row.
It has 2 Foreign Keys both pointing to Operators table, each for every operatorId.