QuoteReplyTopic: Changetracking ComplexProperty Posted: 13-May-2013 at 4:21am
Working with changetracking and complex property:
entity.Period = new Period(new DateTime(2000,01,01), new DateTime(2222,01,01)); entity.EntityAspect.AcceptChanges(); entity.Period = new Period(new DateTime(9000,01,01), new DateTime(9999,01,01));
var complexProperty = entity.EntityAspect.EntityMetadata.ComplexTypeProperties. First(c => c.PropertyInfo.Name.Equals("Period"));
var currentComplexObj = complexProperty.GetValue(entity, EntityVersion.Current); var orginalComplexObj = complexProperty.GetValue(entity, EntityVersion.Original);
The value of the object currentComplexObj is new Period(new DateTime(9000,01,01), new DateTime(9999,01,01)) <- this is right. The value of the object orginalComplexObj is new Period(new DateTime(9000,01,01), new DateTime(9999,01,01)) <- this is wrong.
What am I doing wrong? Where can i get the old original value from the complex property? Sincere regards, Johannes
thanks, for the fix in den 6.1.14 "Fixed a problem with change tracking of Complex Type properties. [D2443]"
Now wehaveanother problemwhen importing theentitesofaEntityManagerinto anotherin an EntityServerSaveInterceptor.WhenimportingentitywithComplexPropertiestheoriginalvalueis lost.
entity11.Period = new Period(new DateTime(9000,01,01), new DateTime(9999,01,01)); entity11.EntityAspect.AcceptChanges(); entity11.Period = new Period(new DateTime(9000,01,01), new DateTime(9999,01,01)); entityManager11.AddEntity(entity11); entityManager22.ImportEntities(entityManager11.Entities, MergeStrategy.OverwriteChanges); var entity22 = entityManager22.Entities.First();
The changetracking information for entity11 works, but not for the entity22.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum