ChangeTracker.state won't change to "Modified"
-
Tuesday, March 06, 2012 4:48 AM
Hi,
I am working on c# WCF program. I have a problem with self tracking. After I changed a value the ChangeTracker.state is still "Unchanged".
I declared data contractor as
[DataContract]
public class CustOrder
{
[DataMember]
IList<Customer> CustomerRows;
[DataMember]
IList<Order> OrderRows;
}I followed the instructions in "Walkthrough: Serialize Self-Tracking Entities" (http://msdn.microsoft.com/en-us/library/ee789839(VS.100).aspx) to create the ServiceReference and the Model.tt and ModelContext.tt files.
On my Client side, the WinForm project and MVP project all have the reference to the Model.tt and ServiceReference.
I got the custOrder and bind it to textboxes, like
textSurname.DataBindings.Add("Text", custOrder.CustomerRows[0], "Surname");After I changed the surname and click a SaveChange button, however, I found the surname in the CustomerRows[0] was changed but the ChangeTracker.state for CustomerRows[0] was still "Unchanged", why? What could cause the problem?
All Replies
-
Tuesday, March 06, 2012 5:22 AMModerator
So the information was updated in the database as you would expect?
Could it be that you looked at the ChangeTracker.state value after you called AcceptChanges method?
This posting is provided "AS IS" with no warranties, and confers no rights.
-
Tuesday, March 06, 2012 11:27 PM
Hi,
Thank u for your help.
I found the problem. I need in the ServiceReference project add a reference to the model.tt project, then generate the ServiceReferences.
- Marked As Answer by Alan_chenModerator Wednesday, March 07, 2012 6:27 AM
-
Tuesday, March 06, 2012 11:28 PMModerator
Yes, this is something that needs to be fixed in the documentation.
Thank you!
This posting is provided "AS IS" with no warranties, and confers no rights.

