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 1029519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:33:22+00:00 2026-05-16T12:33:22+00:00

I have inherited a medium sized database that we are trying to use with

  • 0

I have inherited a medium sized database that we are trying to use with Entity Framework in a MVC2 rewrite we are working on. We used the existing database to generate the data model (.edmx file) and all was good. Until I realized that I could not use the dot notation access all the fields.

appointment.Employee.name   // works fine
appointment.Supervisor.name // this fails
appointment.SupervisorID    // works and is an int

When I looked closer I could see that the first case that worked was most likely a fluke. There are several columns in the table for things like SupervisorID, SecretaryID, DogGroomerID and so, on all pointing to the Employee table and labeled as foreign keys. It looks like Visual Studio almost did the right thing, it just named all this associations after the roles involved, then attached numbers to make them unique. So the folllowing code works:

appointment.Employee1.name // My name
appointment.Employee7.name // My Boss's Name
appointment.Employee5.name // Fluffy's groomer's name

But that really defeats the purpose. So what did I do wrong or what is misconfigured that would make Visual Studio generate such obviously dumb names? I tried changing them in the visual modeling tool and it worked. Renaming Employee7 to Supervisor had the desired effect but that is not really a scalable solution for me to spend the next 10 hours renaming things. What do we do when the database gets revved by the customer in the field again and I need to pull in new schema?

Thanks for any insight and help!

-Eric

  • 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-05-16T12:33:23+00:00Added an answer on May 16, 2026 at 12:33 pm

    Coming back to this the real problem was at a step earlier in the tool chain. We just solved things bu editing the names in the .edmx file and being very careful about merging changes when the database changed. Not a good solution but you can only spend so much time on things.

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

Sidebar

Related Questions

I have inherited a VB6/Access application that we have developed and sold for many
I have inherited a poorly written web application that seems to have errors when
I have inherited a project that uses LLBLGen Pro for the DB layer. The
I have inherited a very messy project. There are at least 3 versions that
I have inherited a site with a news section that displays a summary of
I have inherited a massive stylesheet with many thousand selectors and I'm certain that
I have inherited a client site which crashes every 3 or 4 days. It
I have inherited some legacy PHP code what was written back when it was
I have inherited an old crusty PHP application , and I'd like to refactor
I have inherited a c# class 'Button' (which I can't change) which clashes with

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.