GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Ability to refresh a context from the database · Issue #16491 · dotnet/efcore

Ability to refresh a context from the database #16491

New issue
Copy link
New issue
Copy link
Open
Feature
Open
Ability to refresh a context from the database#16491
Feature
Copy link
Labels
area-change-trackingcustomer-reportedef6-parity
Milestone
Backlog

Description

@knightmeister
knightmeister
opened on Jul 7, 2019
Issue body actions

I'm raising this as I've seen #11706 and #2296 are closed.

I require this functionality for GUI applications, for which EF Core is a viable target - specifically via Xamarin and UWP.

It is possible with EF6 to refresh the context by using Refresh(RefreshMode.StoreWins)

I totally understand that contexts are suggested per-unit of work however GUI applications have long living components (such as the main screen) for which a unit of work isn't suitable.

At this stage I have implemented an internal message bus which indicates when a single entity should be reloaded, but it would be nice to be able to refresh the store and all tracked entities in EF Core.

Reacted by Sven, jaaywags, Mahfoud Bouabdallah, andre9349, José Luis Orihuela Conde, Thomas Hussey, Xriuk, Peter Kurhajec, Netta Shamir, clivingston2 and 29 more

Activity

  1. ajcvickers
    added this to the Backlog milestone on Jul 15, 2019
  2. ajcvickers
    added
    type-enhancement
    on Jul 15, 2019
  3. ajcvickers commented on Jul 15, 2019

    @ajcvickers
    ajcvickers
    on Jul 15, 2019
    Contributor
    More actions

    Triage: Putting this on the backlog to consider behaviors for DbContext in EF Core similar to ObjectContext.Refresh in the old stack.

  4. ajcvickers
    added
    customer-reported
    on Aug 21, 2019
  5. audacity76 commented on Jun 9, 2020

    @audacity76
    audacity76
    on Jun 9, 2020
    More actions

    @ajcvickers Any update on this issue?

    Reacted by George Santana
  6. ajcvickers commented on Jun 9, 2020

    @ajcvickers
    ajcvickers
    on Jun 9, 2020
    Contributor
    More actions

    @audacity76 This issue is in the Backlog milestone. This means that it is not planned for the next release (EF Core 5.0). We will re-assess the backlog following the this release and consider this item at that time. However, keep in mind that there are many other high priority features with which it will be competing for resources.

    Reacted by George Santana
  7. QutfulloOchilov commented on Mar 3, 2021

    @QutfulloOchilov
    QutfulloOchilov
    on Mar 3, 2021
    More actions

    @ajcvickers Any update on this issue?

  8. ajcvickers
    added
    area-change-tracking
    on Aug 12, 2021
  9. AndriySvyryd
    added
    ef6-parity
    on Oct 19, 2022
  10. DamirLisak commented on Jan 12, 2023

    @DamirLisak
    DamirLisak
    on Jan 12, 2023
    More actions

    Will it be also possible to refresh only the affected objects that have been queried from the database like in EF 4 ?
    In a similar way like
    https://learn.microsoft.com/en-us/dotnet/api/system.data.objects.objectquery-1.execute?view=netframework-4.8.1

    query.Include(c => c.RelatedData)...;
    query.MergeOption = MergeOption.OverwriteChanges; // or
    query.Execute(MergeOption.OverwriteChanges);
    
    
    Reacted by Xriuk, Mario Žitković, Aleksandar Agincic, Boby, Peter Kurhajec, Damir Lisak, Marowinger, Karakol61, DaveCousineau, ldfreenet and 2 more
  11. ajcvickers commented on Jan 13, 2023

    @ajcvickers
    ajcvickers
    on Jan 13, 2023
    Contributor
    More actions

    @DamirLisak That's not decided yet.

    Reacted by Damir Lisak and Mario Žitković
  12. DamirLisak commented on Apr 5, 2023

    @DamirLisak
    DamirLisak
    on Apr 5, 2023
    More actions

    @ajcvickers When can we expect a decision? ( I'm asking because we urgently need this feature ;-) )
    If not, do you have a suggestion for a "MergeOption-Workaround" for refreshing entities?

    Reacted by Netta Shamir, Karakol61 and dhbprog
  13. roji commented on Apr 5, 2023

    @roji
    roji
    on Apr 5, 2023
    Member
    More actions

    This issue is in the Backlog milestone. This means that it is not planned for the next release (EF Core 8.0). We will re-assess the backlog following the this release and consider this item at that time. However, keep in mind that there are many other high priority features with which it will be competing for resources. Make sure to vote (👍) for this issue if it is important to you.

    Reacted by Henrik Hoyer, Vanasis Baboomi, Byron Smith, dhbprog and Conor Dockry
  14. hodaschiy commented on Jun 16, 2024

    @hodaschiy
    hodaschiy
    on Jun 16, 2024
    More actions

    @ajcvickers Any update on this issue?

    Reacted by Damir Lisak
  15. roji commented on Jun 16, 2024

    @roji
    roji
    on Jun 16, 2024
    Member
    More actions

    @hodaschiy see the comment just above.

    Reacted by Damir Lisak, Arthur Vickers and hodaschiy
  16. DamirLisak commented on Nov 28, 2024

    @DamirLisak
    DamirLisak
    on Nov 28, 2024
    More actions

    @knightmeister are you still waiting patiently for this feature or have you made your own implementation for it?

  17. knightmeister commented on Nov 29, 2024

    @knightmeister
    knightmeister
    on Nov 29, 2024
    Author
    More actions

    @DamirLisak I ended up just using a message bus. Not elegant but it works.

    Reacted by Damir Lisak
  18. roji
    removed
    type-enhancement
    on Jun 15, 2025
  19. roji
    added the
    Feature
    issue type on Jun 15, 2025
  20. DamirLisak
    added 2 commits that reference this issue on Aug 9, 2025

    dotnet#16491: Implemented legacy Merge-Option Feature from EF/4/5/6

    82f4b66

    * dotnet#16491: Implemented Merge-Option Feature from EF/4/5/6 tested…

    eb1d858
  21. DamirLisak commented on Aug 12, 2025

    @DamirLisak
    DamirLisak
    on Aug 12, 2025
    More actions

    I've added a new extension method

    public static IQueryable<T>Refresh<T>(this IQueryable<T> source, MergeOption mergeOption)

    which is very similar to the mechanism from EF4/5/6. I've tested it with my databases, and it works so far. However, I haven't written any unit tests for it.

    I've opened the following pull request and ask you @roji & @AndriySvyryd to incorporate this functionality into Main 🙏.
    #36556

    This extension isn't critical because it only hooks into the ShapedQueryCompilingExpressionVisitor at one point and is therefore backward compatible.

    I didn't consider adding a Refresh method to the DBContext using RefreshMode.ClientWins/StoreWins necessary, so I omitted it, as this can also be solved at the application level.

    After having to delve quite a bit into your code, I now understand why EF Core runs much more efficiently. Kudos to you for the way you built this!

  22. DamirLisak
    added 2 commits that reference this issue on Aug 15, 2025

    dotnet#16491: Implemented legacy Merge-Option Feature from EF/4/5/6

    ba5329b

    * dotnet#16491: Implemented Merge-Option Feature from EF/4/5/6 tested…

    81450c4
  23. AndriySvyryd
    marked Reloading Data using a query #13620 as a duplicate of this issue on Aug 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-change-trackingcustomer-reportedef6-parity

    Type

    Feature

    Projects

    No projects

      Milestone

      • BacklogNo due date

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402792 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.