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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:18:13+00:00 2026-05-15T23:18:13+00:00

I have a WCF service that uses the entity framework to retrieve records from

  • 0

I have a WCF service that uses the entity framework to retrieve records from the database and map them to POCO objects. These POCO objects are then returned to the client application.

Lets say the client application changes some properties on one of these POCO objects then sends it back to the WCF service to be saved. As far as I can see this POCO object is then completely disconnected from the entity framework context. The way I currently save this is to create a new context object and retrieve the POCO object from the database again, I then copy property values of the POCO object passed in to the method in to the POCO object just retrieve from the database then call save on the context. Is this the best way to be doing this or is there a simpler method?

  • 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-15T23:18:14+00:00Added an answer on May 15, 2026 at 11:18 pm

    The problem here is that EF keeps track of attached objects by using it’s own ‘unique identifier’ for each retrieved object, different from the record’s primary key in your database. That property is of course not marked with the DataMember attribute, so when sent over the WCF service you lose the key that was used by EF to keep track of it. When deserializing the object, it’s no longer the same exact object, but another simpler one containing only the properties marked with the DataMember attribute. So when the service receives them back again, you of course lose the connection between the object and EF.

    Have you tried reattaching the object to the context? I think it should work, but i haven’t tried it myself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a WCF service that uses Entity Framework to query a SQL database.
I have a WCF service that uses basicHttpbinding in development. Now in product we
I have a WCF service that uses a System.ServiceModel.Syndication.SyndicationFeed to create an RSS feed.
I have client application that uses WCF service to insert some data to backend
I have a WCF service that I have to reference from a .net 2.0
I have a WCF service that I call from a windows service. The WCF
I have a WCF service that processes some messages. I use EntityFramework to retrieve
I have a WCF Service that should not enter the faulted state. If there's
I have a WCF service that is hosted in a windows application. The service
I have a WCF Service that exposes a method GetCustomers(). The internals of the

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.