Esempio n. 1
0
        protected IncompleteVirtualEndPointLoadStateBase(FlattenedDeserializationInfo info)
        {
            ArgumentUtility.CheckNotNull("info", info);
            _endPointLoader = info.GetValue <IEndPointLoader> ();

            var realObjectEndPoints = new List <IRealObjectEndPoint>();

            info.FillCollection(realObjectEndPoints);
            _originalOppositeEndPoints = realObjectEndPoints.ToDictionary(ep => ep.ObjectID);
        }
        // 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 void Collections()
        {
            List <object>   list1 = new List <object> (new object[] { "Foo", 1, 3.0 });
            List <DateTime> list2 = new List <DateTime> (new DateTime[] { DateTime.MinValue, DateTime.MaxValue });

            FlattenedSerializationInfo serializationInfo = new FlattenedSerializationInfo();

            serializationInfo.AddCollection(list1);
            serializationInfo.AddCollection(list2);
            object[] data = serializationInfo.GetData();

            FlattenedDeserializationInfo deserializationInfo = new FlattenedDeserializationInfo(data);
            List <object>   deserializedList1 = new List <object> ();
            List <DateTime> deserializedList2 = new List <DateTime> ();

            deserializationInfo.FillCollection(deserializedList1);
            deserializationInfo.FillCollection(deserializedList2);

            Assert.That(deserializedList1, Is.EqualTo(list1));
            Assert.That(deserializedList2, Is.EqualTo(list2));
        }
Esempio n. 4
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);
        }
        public void InvalidCollectionType()
        {
            List <object> list = new List <object> (new object[] { "Foo", 1, 3.0 });

            FlattenedSerializationInfo serializationInfo = new FlattenedSerializationInfo();

            serializationInfo.AddCollection(list);
            object[] data = serializationInfo.GetData();

            List <int> deserializedList1 = new List <int> ();
            FlattenedDeserializationInfo deserializationInfo = new FlattenedDeserializationInfo(data);

            deserializationInfo.FillCollection(deserializedList1);
        }