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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T22:08:36+00:00 2026-05-28T22:08:36+00:00

Lets say that i have 2 instances of the same entity, a and b

  • 0

Lets say that i have 2 instances of the same entity, a and b

a.SomeProp = 2;
b.SomeProp = 1;

I would like to update a with b:s properties:

a = b;
context.SaveChanges();

(a is attached to the context, b is not)

However, the values are not updated. I suppose im doing it the wrong way. Any help is much appreciated.

  • 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-28T22:08:36+00:00Added an answer on May 28, 2026 at 10:08 pm

    If you do

    a = b
    

    then you set a pointing to the same object as b (and the original object pointed to is discarded).

    You need to assign the properties you want to update, like:

    a.SomeProp = b.SomeProp
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have a page in my web application that lets a user update
Let's say you have two instances of the same bean type, and you'd like
I have two objects that are derived from same the base class. Lets say
Let's say I have a couple of entities that look like this: @Entity public
Let's say that I have a bunch of class instances that serve different purposes,
For instance: I have a swf, lets say A, that loads another swf, B.
Lets say that i have 2 pages: index.php and service.php index.php sends an http-post
Lets say that you have a following simple application: <form action=helloServlet method=post> Give name:<input
Lets say that i have a duration of time e.g., 10 minutes . I
Lets say that you have a business object whose current state implies that there

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.