I have a model in my mvc 5 website, I use database first approach. In some tables I have more than one columns referencing the same table. When the data model scaffolds, it appends numbers to the relationship names, is there a way I can give it a defined name so I can understand what each column is used for from within the code. Check below to see a screenshot of one of the occurrences.
In the above, the MainContactPerson and ContactStaffId both map to the same table - Employee, so it created the relationships Employee and Employee1.
In my code, I access it like that above.
NOW WHAT I WANT. Can I rename those relationship names to something like MainContact and ContactStaff so I do something like below in my code.
var client = _db.Organisation.FirstOrDefault();
var mainContactPerson = client.MainContact;
var contactPerson = client.ContactStaff;