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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:23:46+00:00 2026-05-28T20:23:46+00:00

I have a WinForms application which is using Entity Framework to query a database.

  • 0

I have a WinForms application which is using Entity Framework to query a database. The query pulls all of the records from a table, as well as all of the records from an associated table. I am assigning the results of the parent table to a BindingSource and assigning that to another BindingSource to access the child records. The parent BindingSource is bound to a ComboBox and the child BindingSource is bound to a DataGridView. This all works as expected.

My problem is this: at a certain point, I need to implement a refresh feature to pull down all of the records from the database to refresh the view. I have this currently working, but it only refreshes the parent records, not the child records.

The only success I’ve had at getting the desired behavior is to use ObjectQuery.Execute using the MergeOption.NoTracking option. This refreshes both the parent and child records, but if I’m not mistaken, I lose all tracking.

How can I have the child records updated as well? I’ve attempted to use the Include method and specified the child records table, but that had no impact.

  • 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-28T20:23:47+00:00Added an answer on May 28, 2026 at 8:23 pm

    The best option is simply creating new context rebind your controls and execute query again. Refreshing entities is mostly for resolving concurrency issues not of maintaining long living contexts.

    If you want to refresh relations as well you must configure entity set for relations to support refresh. Currently you most probably configure only current object set or object query which will set the behavior only for the main entity:

    var principals = context.Principals.Include("Dependents").ToList();
    
    context.Principals.MergeOption = MergeOption.OverwriteChanges;
    context.Dependents.MergeOption = MergeOption.OverwriteChanges;
    principals = context.Principals.Include("Dependents").ToList();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background We have a WinForms application with Entity Framework 4.2 code-first / FluentAPI using
I have a winforms application in which I am using 2 Forms to display
I have a WinForms C# application using a MS SQL Server Express database. The
I have a Winforms application which is working fine.. using a BackgroundWorkerThread to manage
I have created a C++/CLI mixed DLL which I am using from C# Winforms
HI all, I have a picture box in my C# WinForms application which is
I have Winforms application written in C# which connects to a SQL Server Database.
I have a C#/.NET Winforms application which has some settings stored using A '.settings'
I have a WinForms based application using the .NET 3.5 framework. The application has
We have a WinForms application which runs on a touch-screen on a bit of

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.