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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:26:26+00:00 2026-05-20T03:26:26+00:00

I found something weird. Let’s say I have a Car model and a Company

  • 0

I found something weird. Let’s say I have a Car model and a Company model.

So my Car model has a CompanyId row.

Let’s say I change a Car‘s CompanyId then I SubmitChanges on the DataContext.

Here’s my problem:
The CompanyId of my Car model gets updated. But the Car.Company relation does NOT.

So if I change Car.CompanyId from 1 to 2. Then I output Car.Company.CompanyId, it’ll show up 1 instead of 2.

So my question is: Is there a way to update EVERYTHING in the DataContext?

I’m currently using:

public void RefreshCollection()
{
    // On rafraichit les données à partir de la DB.
    dataContext.Refresh(RefreshMode.KeepChanges);

    // On va chercher les données complête de la table.
    purchaseOrders = from po in dataContext.PurchaseOrders
                     orderby po.PurchaseOrderId ascending
                     select po;
}

To update my collection.

And:

private void sauvegarderToolStripMenuItem_Click(object sender, EventArgs e)
{
    purchaseOrder.OrderDate = orderDate.Value;
    purchaseOrder.RequiredDate = requiredDate.Value;
    purchaseOrder.ShipTo = shipTo.Text;
    purchaseOrder.State = helper.ConvertComboBoxIndexToStateIndex(
        stateKey.SelectedIndex);

    // On cast un autre type pour le forcer à être un ComboBoxItem
    var supplierItem = (ComboBoxItem)supplierId.SelectedItem;
    purchaseOrder.SupplierId = supplierItem.Id;

    dataContext.SubmitChanges();
}

To submit my changes.

  • 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-20T03:26:27+00:00Added an answer on May 20, 2026 at 3:26 am

    You may want to check out the answers to this question.

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

Sidebar

Related Questions

I have just found something very weird while developing a website. While trying to
I just found something weird in the Python interpreter. Let me show you: $
Ok, so I found something weird over the weekend. I have a WPF app
I have a weird problem. I generate a HTML page, hosted let's say at
I'm working with parsing custom attributes, and I've come across something weird. Let's say
let say I have a post that can be found on page post.php?pid=60 but
I found a weird way of how mysql does something. Someone please explain why
Hi I am doing android development, and found something weird while using socket API.
I just found something that sounds weird with Maven plugin management. While working on
today i found something weird behavior of asp.net default website template. I tried to

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.