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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:27:50+00:00 2026-06-18T03:27:50+00:00

Comrades, can anyone help me out here, entity framework 5 seems not to have

  • 0

Comrades, can anyone help me out here, entity framework 5 seems not to have ApplyCurrentValues() method. Is there another way to update the database object in entity framework v5. here is what am trying to do

odc.Accounts.Attach(new Account { AccountID = account.AccountID });
  odc.Accounts.ApplyCurrentValues(account);
  odc.SaveChanges();

But i have been getting compile error in the ApplyCurrentValues() line

  • 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-18T03:27:52+00:00Added an answer on June 18, 2026 at 3:27 am

    ApplyCurrentValues is an ObjectContext API method, so first you have to gain access to the objectcontext that is wrapped in the DbContext:

    odc.Accounts.Attach(new Account { AccountID = account.AccountID });
    ((IObjectContextAdapter)odc).ObjectContext
        .ApplyCurrentValues("Accounts", account);
    odc.SaveChanges();
    

    Note that the wrapped context does not have members like “Accounts”, so you have to use the ObjectContext method itself.

    But you can do the same using the DbContext API:

    var sourceAcc = new Account { AccountID = account.AccountID });
    odc.Entry(account).CurrentValues.SetValues(sourceAcc);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

comrades) I've found some interesting behavior of Invalidate method in multithreaded applications. I hope
Comrades, The following does not work: vector<string>::iterator c; for( c = holdtype.begin(); c !=
One of our comrades, Peter Mortensen , asked a question on Super User about an
Greetings great SO comrades; I'm trying to use this code to make changes to
comrade@hp:~/workspace/JNI2/src$ ls Prompt.c Prompt.class Prompt.h Prompt.java comrade@hp:~/workspace/JNI2/src$ gcc --shared -o libPrompt.so -I/usr/lib/jvm/java-6-openjdk-i386/include -I/usr/lib/jvm/java-6-openjdk-i386/include/linux -lX11
Comarades, I tried using the append and prepend (), but none of the controls
I was asked the following Question: How would you store the data given below(which
Let me explain what I mean in my title. Let's say, that for example
I am using WAMP with a new WordPress blog. I am hosting this on
According to the Ruby docs for Time#zone : As of Ruby 1.8, returns UTC

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.