This question is locked. New answers and comments are not allowed.
Hi,
I'm writing some proof-of-concept code using ObjectNetworkAttacher and your oneexample.zip.
Instead of XmlSerializer (cause of IList bug) I'm using NetContractSerializer/DataContract serializer. The last one work well: I can deserialize and serialize objects with IList (modified from oneexample.zip):
byte[] serializedObject = null; |
using (MemoryStream stream = new MemoryStream()) |
{ |
DataContractSerializer serializer = new DataContractSerializer(typeof(B)); |
serializer.WriteObject(stream, b); |
serializedObject = stream.GetBuffer(); |
} |
But.
When I try to commit my changes back to the database
// deserialize b |
MemoryStream stream2 = new MemoryStream(serializedObject); |
DataContractSerializer serializer2 = new DataContractSerializer(typeof(B)); |
B deserializedB = (B)serializer2.ReadObject(stream2); |
deserializedB.Name = "changed"; |
// attach |
scope = ObjectScopeProvider1.GetNewObjectScope(); |
scope.Transaction.Begin(); |
B attachedB = (B) ObjectNetworkAttacher.AttachXML(scope, deserializedB); |
scope.Transaction.Commit(); // throws exception |
I've got "A conflicting object was added remotely and concurrently in the database." exception. ObjectNetworkAttacher thinks that this object is "remotenew".
I think there is a version member issue, because the version propery is 0 and not 1 - but why?