Answered by:
Change tracking over wcf with poco proxys

Question
-
Hi there, :)
at first sorry for my (hopely not too) bad english and greetings from germany.
I have the following screnario:
I am working with poco proxys and send the objects over wcf to a client.
The client change some thinks and send it back.
The first i try to update where:dataServerDBContext.ApplyCurrentValues("Project", project); // apply changes dataServerDBContext.AcceptAllChanges(); dataServerDBContext.SaveChange(SaveOptions.DetectChangesBeforeSave);
But whats happen is that the propertys of the poco object where saved but not the relationshipps this other object
(for example: "Project" has 1:n "Contacts")The second i try was:
// Get ObjectStateEntry from EntityKey. ObjectStateEntry stateEntry = dataServerDBContext.ObjectStateManager.GetObjectStateEntry(project);
but i can see tha the back comming object is not a proxy anymore.
can you please help me to make a complet change tracking on the update back sended poco object??
thanks for you answeres and best regards
Steffen MangoldWednesday, June 16, 2010 9:24 AM
Answers
-
Hi again Steffen,
I assume you go on researching this issue in these threads,
Let’s continue the discussion there.
Good day!
Best Regards,
Lingzhi Sun
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Proposed as answer by Jonathan Aneja -- MSFT Tuesday, June 22, 2010 2:20 AM
- Marked as answer by Michael Sun [MSFT]Microsoft employee Wednesday, June 23, 2010 1:56 AM
Monday, June 21, 2010 6:25 AM
All replies
-
After some more searching the web i found out that ApplyCurrentValues("Project", project); dont saves relationships. So that was the false way.
So my question is, after recieving an entity, is there a way to automaticly let the EF4 detect witch relationsship has changed (added, deleted)??
PLS help
Wednesday, June 16, 2010 2:11 PM -
Yes,
You can do something like this:
var relationship = context.ObjectStateManager.GetObjectStateEntries(EntityState.Added);
Hope this help,
JAReyes.
Wednesday, June 16, 2010 2:34 PM -
no sry i cant do this. because i recieve a persist ignore POCO object, so i have no direct change tracking to look what the client has changed. I only see the editing result.
Wednesday, June 16, 2010 2:46 PM -
Hi again Steffen,
I assume you go on researching this issue in these threads,
Let’s continue the discussion there.
Good day!
Best Regards,
Lingzhi Sun
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Proposed as answer by Jonathan Aneja -- MSFT Tuesday, June 22, 2010 2:20 AM
- Marked as answer by Michael Sun [MSFT]Microsoft employee Wednesday, June 23, 2010 1:56 AM
Monday, June 21, 2010 6:25 AM