// 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?>(); }
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)); }
protected FlattenedSerializableStub(FlattenedDeserializationInfo info) { Data1 = info.GetValue <string> (); Data2 = info.GetIntValue(); Data3 = info.GetValueForHandle <FlattenedSerializableStub> (); }