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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:21:40+00:00 2026-06-13T11:21:40+00:00

I have 2 tables in ms sql server 2008 R2, one of which has

  • 0

I have 2 tables in ms sql server 2008 R2, one of which has foreign key relation to the other

pretty simple:

tableA
prefix nchar(10)
value  nchar(50)

tableB
prefix nchar(10)
value  nchar(50)

ALTER TABLE [dbo].[tableB]  
WITH CHECK ADD  CONSTRAINT [FK_TableA_TableB] FOREIGN KEY([prefix])
REFERENCES [dbo].[TableA] ([prefix])

I fill in data in the tables using the management studio edit table. ensuring each prefix in tableB has a matching prefix in tableA.

Then I import the tables into visual studio C# to create an entity framework model.
Everything seem to work fine until I start to reference data in tableA from tableB using the navigation handle, it comes up empty handed.

i.e. tableB.tableAs come out as null.

Is there a step that needs to be done to update foreign key relations in entity framework and/or ms sql server?

  • 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-13T11:21:41+00:00Added an answer on June 13, 2026 at 11:21 am

    To help others with a similar problem, I am posting what I believe is the solution. Turns out I assumed references were loaded automatically in the Entity Framework. In order to get updated, references need to be explicitly loaded like this

    if (!tableB.tableAs.IsLoaded)
        tableB.tableAs.Load();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have SQL Server 2008 R2 and one of my tables has a date
I have two tables in sql server 2008 R2. one table has records as
I have 2 Identical tables in SQL Server 2008, one is the Live table
In SQL Server 2008 I have two tables. One table for users: id_user -
In SQL Server 2008: I have two tables, dtlScheme and dtlRenewal, with a one
I have a database in SQL Server 2008 and one particular table has information
We have a SQL server 2008 and one of the tables, say table A
I have the following tables in a SQL Server 2008 db: tblItem , which
In SQL Server 2008: I have one table, and I want to do something
i have four tables like below in sql server 2008 : TABLE 1 ->

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.