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

  • Home
  • SEARCH
  • 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 6157025
In Process

The Archive Base Latest Questions

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

I fetch the object from the database (POCO object with proxy) I modify its

  • 0
  1. I fetch the object from the database (POCO object with proxy)
  2. I modify its property without saving changes
  3. I fetch it later on again from the database (I use the same object context)
  4. What is the value of the property?

For example if I have object context with collection Users then what is the result of the following:

ObjectContext o = ....;
User u = o.Users.First(u=>u.Id == 1);
Console.WriteLine(u.LastName); // I get 'test' for example
u.LastName = 'SomethingElse';
u  = o.Users.First(u=>u.Id == 1);
Console.WriteLine(u.LastName); // What is the result??

If the result of the last statement is not the string “SomethingElse” then is there a way to achieve this funcionality?

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

    That is the core feature of ORM tools called identity map pattern. Entity with unique key can be materialized only once per context so the second query will be default use the same instance without changing its values.

    You can force the query to refresh values by either:

    ObjectContext o = ....;
    User u = o.Users.First(u=>u.Id == 1);
    Console.WriteLine(u.LastName); // I get 'test' for example
    u.LastName = 'SomethingElse';
    o.Users.MergeOption = MergeOption.OverwriteChagnes; // Here you change the behavior
    u  = o.Users.First(u=>u.Id == 1);
    Console.WriteLine(u.LastName); // result is 'test' again
    

    or by reloading the entity itself:

    ObjectContext o = ....;
    User u = o.Users.First(u=>u.Id == 1);
    Console.WriteLine(u.LastName); // I get 'test' for example
    u.LastName = 'SomethingElse';
    o.Refresh(RefreshMode.StoreWins, u); // Here you reload entity with values from the database
    Console.WriteLine(u.LastName); // result is 'test' again    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a OleDbDataAdapter object to fetch certain data from a database and place
I've made POCO object mapped to database like this: class MoneyObject { Money MoneyAmmount
I want to fetch multiple feeds from the database and in so doing fetch
Fortunately, I know how to fetch data from the database, That's not a problem.
I'm trying to fetch some HTML from various blogs and have noticed that different
How can I fetch data in a Winforms application or ASP.NET form from a
How can I fetch images from a server? I've got this bit of code
Is it possible to fetch the current application version programmatically for use in urls
In my POCO class I have 16 attributes that are mapped to the database
I'm currently working with the versant object database (using jvi), and have a case

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.