Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8504803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:08:17+00:00 2026-06-11T02:08:17+00:00

I would like to rename a navigation property and access that object in code

  • 0

I would like to rename a navigation property and access that object in code by the new name I gave. I have renamed one of my user properties to a more meaningful name rather than 1,2,3…etc.

In this example, I have renamed OGSMUser5 to OGSMUserResponsible in the model diagram.

I then tried to access this in code, but it can’t find my renamed property OGSMUserResponsible.

@contImprovement.OGSMUserResponsible.FullName

When I look at the code in the model generated from Entity Data Model, I see that the code did not change for the newly renamed model, which explains why I can’t 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 have seen somewhat similar questions to this, but the answers I have seen I can’t believe is the only option. They have been manually creating a new property with the name you want (what I renamed mine to in the navigation property) in a partial class and return the navigation property with the number in the name to help clean it up. I can’t believe that this is the best way to accomplish what I am looking for.

Thanks for the help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T02:08:18+00:00Added an answer on June 11, 2026 at 2:08 am

    You probably didn’t run the T4 template transformations.

    Just right click your .tt files (they are under your .edmx file in the Solution Explorer tree) and run them. Alternatively, you can run all tt by clicking the button in Visual Studio’s toolbar.

    T4 templates run in Visual Studio

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some files that I would like to rename using regex and powershell,
I have a set of directories called CODE (GRADE) and would like to rename
I have several folders with some files that I would like to rename from
I have a poorly named column that I would like to rename. The column
I have an object, that I would like to interact with dynamically. I would
I would like to rename files numbering: I have a files with '???' format
I would like to append two strings together so that I can rename a
I would like to rename a large number of columns (column headers) to have
I would like to rename the installer file that CPack (v2.8.7) produces to include
i have a file that looks like this: TTITLE0=track name 1 TTITLE1=track name 2

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.