コード例 #1
0
        public SynchronizedRealObjectEndPointSyncState(FlattenedDeserializationInfo info)
        {
            ArgumentUtility.CheckNotNull("info", info);

            _endPointProvider     = info.GetValueForHandle <IRelationEndPointProvider>();
            _transactionEventSink = info.GetValueForHandle <IClientTransactionEventSink>();
        }
コード例 #2
0
        // 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?>();
        }
コード例 #3
0
 protected RealObjectEndPoint(FlattenedDeserializationInfo info)
     : base(info)
 {
     _foreignKeyDataContainer = info.GetValueForHandle <DataContainer> ();
     _propertyDefinition      = GetPropertyDefinition();
     _endPointProvider        = info.GetValueForHandle <IRelationEndPointProvider> ();
     _transactionEventSink    = info.GetValueForHandle <IClientTransactionEventSink> ();
     _syncState = info.GetValueForHandle <IRealObjectEndPointSyncState> ();
 }
コード例 #4
0
        public VirtualObjectEndPointDataManager(FlattenedDeserializationInfo info)
        {
            ArgumentUtility.CheckNotNull("info", info);

            _endPointID = info.GetValueForHandle <RelationEndPointID>();
            _originalOppositeEndPoint = info.GetValue <IRealObjectEndPoint>();
            _originalOppositeObject   = info.GetValueForHandle <DomainObject>();
            _currentOppositeEndPoint  = info.GetValue <IRealObjectEndPoint>();
            _currentOppositeObject    = info.GetValueForHandle <DomainObject> ();
        }
コード例 #5
0
        protected DataContainerMap(FlattenedDeserializationInfo info)
            : this(info.GetValueForHandle <IClientTransactionEventSink>())
        {
            var dataContainerCount = info.GetValue <int>();

            for (int i = 0; i < dataContainerCount; ++i)
            {
                _dataContainers.Add(info.GetValueForHandle <DataContainer>());
            }
        }
コード例 #6
0
        public void Handles()
        {
            DateTime dt1 = DateTime.MinValue;
            DateTime dt2 = DateTime.MaxValue;

            string s1 = "Foo";
            string s2 = "Fox";

            FlattenedSerializationInfo serializationInfo = new FlattenedSerializationInfo();

            serializationInfo.AddHandle(dt1);
            serializationInfo.AddHandle(dt2);
            serializationInfo.AddHandle(dt1);
            serializationInfo.AddHandle(dt1);
            serializationInfo.AddHandle(s1);
            serializationInfo.AddHandle(s2);
            serializationInfo.AddHandle(s1);
            serializationInfo.AddHandle(s1);
            serializationInfo.AddHandle(s2);

            object[] data = serializationInfo.GetData();

            FlattenedDeserializationInfo deserializationInfo = new FlattenedDeserializationInfo(data);

            Assert.That(deserializationInfo.GetValueForHandle <DateTime> (), Is.EqualTo(dt1));
            Assert.That(deserializationInfo.GetValueForHandle <DateTime> (), Is.EqualTo(dt2));
            Assert.That(deserializationInfo.GetValueForHandle <DateTime> (), Is.EqualTo(dt1));
            Assert.That(deserializationInfo.GetValueForHandle <DateTime> (), Is.EqualTo(dt1));
            Assert.That(deserializationInfo.GetValueForHandle <string> (), Is.EqualTo(s1));
            Assert.That(deserializationInfo.GetValueForHandle <string> (), Is.EqualTo(s2));
            Assert.That(deserializationInfo.GetValueForHandle <string> (), Is.EqualTo(s1));
            Assert.That(deserializationInfo.GetValueForHandle <string> (), Is.EqualTo(s1));
            Assert.That(deserializationInfo.GetValueForHandle <string> (), Is.EqualTo(s2));
        }
コード例 #7
0
        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();
        }
コード例 #8
0
        protected CompleteVirtualEndPointLoadStateBase(FlattenedDeserializationInfo info)
        {
            ArgumentUtility.CheckNotNull("info", info);

            _dataManager          = info.GetValueForHandle <TDataManager> ();
            _endPointProvider     = info.GetValueForHandle <IRelationEndPointProvider> ();
            _transactionEventSink = info.GetValueForHandle <IClientTransactionEventSink> ();
            var unsynchronizedOppositeEndPoints = new List <IRealObjectEndPoint> ();

            info.FillCollection(unsynchronizedOppositeEndPoints);
            _unsynchronizedOppositeEndPoints = unsynchronizedOppositeEndPoints.ToDictionary(ep => ep.ObjectID);
        }
コード例 #9
0
        // ReSharper disable UnusedMember.Local
        private RelationEndPointID(FlattenedDeserializationInfo info)
        {
            var classDefinitionID = info.GetValueForHandle <string> ();
            var propertyName      = info.GetValueForHandle <string> ();
            var objectID          = info.GetValueForHandle <ObjectID> ();

            var classDefinition            = MappingConfiguration.Current.GetClassDefinition(classDefinitionID);
            var relationEndPointDefinition = classDefinition.GetMandatoryRelationEndPointDefinition(propertyName);

            _objectID   = objectID;
            _definition = relationEndPointDefinition;
        }
コード例 #10
0
        protected RelationEndPointManager(FlattenedDeserializationInfo info)
        {
            ArgumentUtility.CheckNotNull("info", info);

            _clientTransaction = info.GetValueForHandle <ClientTransaction>();
            _lazyLoader        = info.GetValueForHandle <ILazyLoader>();
            _endPointFactory   = info.GetValueForHandle <IRelationEndPointFactory>();
            _registrationAgent = info.GetValueForHandle <IRelationEndPointRegistrationAgent> ();
            _map = info.GetValue <RelationEndPointMap> ();

            _dataContainerEndPointsRegistrationAgent = new DelegatingDataContainerEndPointsRegistrationAgent(_endPointFactory, _registrationAgent);
        }
コード例 #11
0
        public void NullHandles()
        {
            FlattenedSerializationInfo serializationInfo = new FlattenedSerializationInfo();

            serializationInfo.AddHandle <string> (null);
            serializationInfo.AddHandle <int?> (null);

            object[] data = serializationInfo.GetData();

            FlattenedDeserializationInfo deserializationInfo = new FlattenedDeserializationInfo(data);

            Assert.That(deserializationInfo.GetValueForHandle <string> (), Is.EqualTo(null));
            Assert.That(deserializationInfo.GetValueForHandle <int?> (), Is.EqualTo(null));
        }
コード例 #12
0
        void IDeserializationCallback.OnDeserialization(object sender)
        {
            var doInfo = new FlattenedDeserializationInfo(_deserializedData);

            _clientTransaction          = doInfo.GetValueForHandle <ClientTransaction> ();
            _transactionEventSink       = doInfo.GetValueForHandle <IClientTransactionEventSink> ();
            _dataContainerEventListener = doInfo.GetValueForHandle <IDataContainerEventListener> ();
            _dataContainerMap           = doInfo.GetValue <DataContainerMap>();
            _relationEndPointManager    = doInfo.GetValueForHandle <RelationEndPointManager>();
            _domainObjectStateCache     = doInfo.GetValue <DomainObjectStateCache>();
            _invalidDomainObjectManager = doInfo.GetValue <IInvalidDomainObjectManager> ();
            _objectLoader = doInfo.GetValueForHandle <IObjectLoader>();

            _deserializedData = null;
            doInfo.SignalDeserializationFinished();
        }
コード例 #13
0
        public void HandlesWithInvalidType()
        {
            DateTime dt1 = DateTime.MinValue;

            FlattenedSerializationInfo serializationInfo = new FlattenedSerializationInfo();

            serializationInfo.AddHandle(dt1);
            serializationInfo.AddHandle(dt1);

            object[] data = serializationInfo.GetData();

            FlattenedDeserializationInfo deserializationInfo = new FlattenedDeserializationInfo(data);

            deserializationInfo.GetValueForHandle <DateTime> ();
            deserializationInfo.GetValueForHandle <string> ();
        }
コード例 #14
0
        public void FlattenedSerializableHandles_WithOtherHandles()
        {
            FlattenedSerializableStub stub1 = new FlattenedSerializableStub("begone, foul fiend", 123);
            FlattenedSerializableStub stub2 = new FlattenedSerializableStub("befoul, gone fiend", 125);

            stub1.Data3 = stub2;

            FlattenedSerializationInfo serializationInfo = new FlattenedSerializationInfo();

            serializationInfo.AddHandle(stub1);
            object[] data = serializationInfo.GetData();

            FlattenedDeserializationInfo deserializationInfo = new FlattenedDeserializationInfo(data);
            FlattenedSerializableStub    deserializedStub1   = deserializationInfo.GetValueForHandle <FlattenedSerializableStub> ();
            FlattenedSerializableStub    deserializedStub2   = deserializedStub1.Data3;

            Assert.That(deserializedStub2, Is.Not.SameAs(deserializedStub1));
            Assert.That(deserializedStub1.Data1, Is.EqualTo("begone, foul fiend"));
            Assert.That(deserializedStub1.Data2, Is.EqualTo(123));
            Assert.That(deserializedStub1.Data3, Is.SameAs(deserializedStub2));

            Assert.That(deserializedStub2.Data1, Is.EqualTo("befoul, gone fiend"));
            Assert.That(deserializedStub2.Data2, Is.EqualTo(125));
            Assert.That(deserializedStub2.Data3, Is.Null);
        }
コード例 #15
0
        public void FlattenedSerializableHandles_RecursiveHandles()
        {
            FlattenedSerializableStub stub1 = new FlattenedSerializableStub("begone, foul fiend", 123);
            FlattenedSerializableStub stub2 = new FlattenedSerializableStub("befoul, gone fiend", 125);

            stub1.Data3 = stub2;
            stub2.Data3 = stub1;

            FlattenedSerializationInfo serializationInfo = new FlattenedSerializationInfo();

            serializationInfo.AddHandle(stub1);
            object[] data = serializationInfo.GetData();

            FlattenedDeserializationInfo deserializationInfo = new FlattenedDeserializationInfo(data);

            deserializationInfo.GetValueForHandle <FlattenedSerializableStub> ();
            // The following would be expected if this worked
            //FlattenedSerializableStub deserializedStub1 = deserializationInfo.GetValueForHandle<FlattenedSerializableStub> ();
            //FlattenedSerializableStub deserializedStub2 = deserializedStub1.Data3;

            //Assert.AreNotSame (deserializedStub1, deserializedStub2);
            //Assert.AreEqual ("begone, foul fiend", deserializedStub1.Data1);
            //Assert.AreEqual (123, deserializedStub1.Data2);
            //Assert.AreSame (deserializedStub2, deserializedStub1.Data3);

            //Assert.AreEqual ("befoul, gone fiend", deserializedStub2.Data1);
            //Assert.AreEqual (125, deserializedStub2.Data2);
            //Assert.AreSame (deserializedStub1, deserializedStub2.Data3);
        }
コード例 #16
0
        protected RelationEndPointMap(FlattenedDeserializationInfo info)
            : this(info.GetValueForHandle <IClientTransactionEventSink>())
        {
            var endPointArray = info.GetArray <IRelationEndPoint> ();

            foreach (IRelationEndPoint endPoint in endPointArray)
            {
                _relationEndPoints.Add(endPoint.ID, endPoint);
            }
        }
コード例 #17
0
        // ReSharper disable UnusedMember.Local
        private CollectionEndPointDataManager(FlattenedDeserializationInfo info)
        {
            ArgumentUtility.CheckNotNull("info", info);

            _endPointID = info.GetValueForHandle <RelationEndPointID>();
            _changeDetectionStrategy = info.GetValueForHandle <ICollectionEndPointChangeDetectionStrategy>();

            _changeCachingCollectionData = info.GetValue <ChangeCachingCollectionDataDecorator>();

            _originalOppositeEndPoints = new HashSet <IRealObjectEndPoint>();
            info.FillCollection(_originalOppositeEndPoints);

            _originalItemsWithoutEndPoint = new HashSet <DomainObject>();
            info.FillCollection(_originalItemsWithoutEndPoint);

            var currentOppositeEndPoints = new List <IRealObjectEndPoint>();

            info.FillCollection(currentOppositeEndPoints);
            _currentOppositeEndPoints = currentOppositeEndPoints.ToDictionary(ep => ep.ObjectID);
        }
 public StateUpdateRaisingCollectionEndPointDecorator (FlattenedDeserializationInfo info)
 {
   _innerEndPoint = info.GetValue<ICollectionEndPoint>();
   _listener = info.GetValueForHandle<IVirtualEndPointStateUpdateListener>();
 }
 public IncompleteCollectionEndPointLoadState(FlattenedDeserializationInfo info)
     : base(info)
 {
     _dataManagerFactory = info.GetValueForHandle <ICollectionEndPointDataManagerFactory>();
 }
コード例 #20
0
 public UnknownRealObjectEndPointSyncState(FlattenedDeserializationInfo info)
 {
     ArgumentUtility.CheckNotNull("info", info);
     _virtualEndPointProvider = info.GetValueForHandle <IRelationEndPointProvider>();
 }
コード例 #21
0
            public EndPointLoader(FlattenedDeserializationInfo info)
            {
                ArgumentUtility.CheckNotNull("info", info);

                _lazyLoader = info.GetValueForHandle <ILazyLoader>();
            }
コード例 #22
0
 protected RelationEndPoint(FlattenedDeserializationInfo info)
 {
     _clientTransaction = info.GetValueForHandle <ClientTransaction>();
     _id = info.GetValue <RelationEndPointID>();
 }
コード例 #23
0
 protected FlattenedSerializableStub(FlattenedDeserializationInfo info)
 {
     Data1 = info.GetValue <string> ();
     Data2 = info.GetIntValue();
     Data3 = info.GetValueForHandle <FlattenedSerializableStub> ();
 }