I would like to rename the navigation property and access this object in code using the new name I gave. I renamed one of my user properties to a more meaningful name, rather than 1,2,3 ... etc.
In this example, I renamed OGSMUser5 to OGSMUserResponsible in the model diagram.
Then I tried to access this in the code, but it cannot find my renamed OGSMUserResponsible property.
@contImprovement.OGSMUserResponsible.FullName
When I look at the code in the model created using the entity data model, I see that the code has not changed for the recently renamed model, which explains why I cannot access it.
public virtual OGSMUser OGSMUser { get; set; } public virtual OGSMUser OGSMUser1 { get; set; } public virtual OGSMUser OGSMUser2 { get; set; } public virtual OGSMUser OGSMUser3 { get; set; } public virtual OGSMUser OGSMUser4 { get; set; } public virtual OGSMUser OGSMUser5 { get; set; }
I saw several similar questions, but the answers that I saw, I canβt believe, this is the only option. They manually created a new property with the desired name (what I renamed to the navigation property in the partial class) and return the navigation property with a number in the name to help clear it. I cannot believe that this is the best way to accomplish what I am looking for.
Thanks for the help.
source share