// ReSharper disable UnusedMember.Local private DataContainer(FlattenedDeserializationInfo info) { ArgumentUtility.CheckNotNull("info", info); _id = info.GetValueForHandle <ObjectID> (); _timestamp = info.GetValue <object>(); _isDiscarded = info.GetBoolValue(); _propertyValues = new Dictionary <PropertyDefinition, PropertyValue>(); if (!_isDiscarded) { for (int i = 0; i < ClassDefinition.GetPropertyDefinitions().Count(); ++i) { var propertyName = info.GetValueForHandle <string>(); var propertyDefinition = ClassDefinition.GetPropertyDefinition(propertyName); var propertyValue = new PropertyValue(propertyDefinition, propertyDefinition.DefaultValue); propertyValue.DeserializeFromFlatStructure(info); _propertyValues.Add(propertyDefinition, propertyValue); } } _clientTransaction = info.GetValueForHandle <ClientTransaction> (); _eventListener = info.GetValueForHandle <IDataContainerEventListener> (); _state = (DataContainerStateType)info.GetIntValue(); _domainObject = info.GetValueForHandle <DomainObject> (); _hasBeenMarkedChanged = info.GetBoolValue(); _hasBeenChanged = info.GetValue <bool?>(); }
protected VirtualObjectEndPoint(FlattenedDeserializationInfo info) : base(info) { _lazyLoader = info.GetValueForHandle <ILazyLoader> (); _endPointProvider = info.GetValueForHandle <IRelationEndPointProvider> (); _transactionEventSink = info.GetValueForHandle <IClientTransactionEventSink> (); _dataManagerFactory = info.GetValueForHandle <IVirtualObjectEndPointDataManagerFactory> (); _loadState = info.GetValue <IVirtualObjectEndPointLoadState> (); _hasBeenTouched = info.GetBoolValue(); }
internal void DeserializeFromFlatStructure(FlattenedDeserializationInfo info) { _hasBeenTouched = info.GetBoolValue(); _value = info.GetValue <object> (); if (_hasBeenTouched) { _originalValue = info.GetValue <object> (); } else { _originalValue = _value; } }
public void Values() { FlattenedSerializationInfo serializationInfo = new FlattenedSerializationInfo(); serializationInfo.AddIntValue(1); serializationInfo.AddBoolValue(true); serializationInfo.AddIntValue(2); serializationInfo.AddBoolValue(false); serializationInfo.AddValue(new DateTime(2007, 1, 2)); serializationInfo.AddValue("Foo"); serializationInfo.AddValue <object> (null); serializationInfo.AddValue <int?> (null); object[] data = serializationInfo.GetData(); FlattenedDeserializationInfo deserializationInfo = new FlattenedDeserializationInfo(data); Assert.That(deserializationInfo.GetIntValue(), Is.EqualTo(1)); Assert.That(deserializationInfo.GetBoolValue(), Is.EqualTo(true)); Assert.That(deserializationInfo.GetIntValue(), Is.EqualTo(2)); Assert.That(deserializationInfo.GetBoolValue(), Is.EqualTo(false)); Assert.That(deserializationInfo.GetValue <DateTime> (), Is.EqualTo(new DateTime(2007, 1, 2))); Assert.That(deserializationInfo.GetValue <string> (), Is.EqualTo("Foo")); Assert.That(deserializationInfo.GetValue <int?> (), Is.EqualTo(null)); }