Exemple #1
0
        protected virtual IVirtualEndPoint RegisterOppositeForRealObjectEndPoint(IRealObjectEndPoint realObjectEndPoint)
        {
            ArgumentUtility.CheckNotNull("realObjectEndPoint", realObjectEndPoint);

            var oppositeVirtualEndPointID = RelationEndPointID.CreateOpposite(realObjectEndPoint.Definition, realObjectEndPoint.OriginalOppositeObjectID);

            if (oppositeVirtualEndPointID.Definition.IsAnonymous)
            {
                realObjectEndPoint.MarkSynchronized();
                return(null);
            }

            var oppositeVirtualEndPoint = _virtualEndPointProvider.GetOrCreateVirtualEndPoint(oppositeVirtualEndPointID);

            oppositeVirtualEndPoint.RegisterOriginalOppositeEndPoint(realObjectEndPoint);
            return(oppositeVirtualEndPoint);
        }
Exemple #2
0
        public static T GetEndPointWithOppositeDefinition <T> (this IRelationEndPoint endPoint, ObjectID oppositeObjectID) where T : IRelationEndPoint
        {
            ArgumentUtility.CheckNotNull("endPoint", endPoint);

            var oppositeDefinition = endPoint.Definition.GetOppositeEndPointDefinition();

            var id = RelationEndPointID.Create(oppositeObjectID, oppositeDefinition);
            var oppositeEndPoint = endPoint.ClientTransaction.DataManager.GetRelationEndPointWithLazyLoad(id);

            if (!(oppositeEndPoint is T))
            {
                var message = String.Format(
                    "The opposite end point '{0}' is of type '{1}', not of type '{2}'.",
                    oppositeEndPoint.ID,
                    oppositeEndPoint.GetType(),
                    typeof(T));
                throw new InvalidOperationException(message);
            }

            return((T)oppositeEndPoint);
        }
Exemple #3
0
        public CollectionEndPoint(
            ClientTransaction clientTransaction,
            RelationEndPointID id,
            ICollectionEndPointCollectionManager collectionManager,
            ILazyLoader lazyLoader,
            IRelationEndPointProvider endPointProvider,
            IClientTransactionEventSink transactionEventSink,
            ICollectionEndPointDataManagerFactory dataManagerFactory)
            : base(ArgumentUtility.CheckNotNull("clientTransaction", clientTransaction), ArgumentUtility.CheckNotNull("id", id))
        {
            ArgumentUtility.CheckNotNull("collectionManager", collectionManager);
            ArgumentUtility.CheckNotNull("lazyLoader", lazyLoader);
            ArgumentUtility.CheckNotNull("endPointProvider", endPointProvider);
            ArgumentUtility.CheckNotNull("transactionEventSink", transactionEventSink);
            ArgumentUtility.CheckNotNull("dataManagerFactory", dataManagerFactory);

            if (id.Definition.Cardinality != CardinalityType.Many)
            {
                throw new ArgumentException("End point ID must refer to an end point with cardinality 'Many'.", "id");
            }

            if (id.Definition.IsAnonymous)
            {
                throw new ArgumentException("End point ID must not refer to an anonymous end point.", "id");
            }

            Assertion.IsTrue(ID.Definition.IsVirtual);

            _hasBeenTouched       = false;
            _collectionManager    = collectionManager;
            _lazyLoader           = lazyLoader;
            _endPointProvider     = endPointProvider;
            _transactionEventSink = transactionEventSink;
            _dataManagerFactory   = dataManagerFactory;

            SetIncompleteLoadState();
        }
Exemple #4
0
        public ICollectionEndPoint CreateCollectionEndPoint(RelationEndPointID endPointID)
        {
            var endPoint = _innerFactory.CreateCollectionEndPoint(endPointID);

            return(new StateUpdateRaisingCollectionEndPointDecorator(endPoint, _listener));
        }
Exemple #5
0
        public IVirtualObjectEndPoint CreateVirtualObjectEndPoint(RelationEndPointID endPointID)
        {
            var endPoint = _innerFactory.CreateVirtualObjectEndPoint(endPointID);

            return(new StateUpdateRaisingVirtualObjectEndPointDecorator(endPoint, _listener));
        }
Exemple #6
0
 public IRealObjectEndPoint CreateRealObjectEndPoint(RelationEndPointID endPointID, DataContainer dataContainer)
 {
     return(_innerFactory.CreateRealObjectEndPoint(endPointID, dataContainer));
 }
 public IRelationEndPoint this[RelationEndPointID endPointID]
 {
     get { return(_relationEndPoints.GetValueOrDefault(endPointID)); }
 }
 protected RelationEndPoint(FlattenedDeserializationInfo info)
 {
     _clientTransaction = info.GetValueForHandle <ClientTransaction>();
     _id = info.GetValue <RelationEndPointID>();
 }
 public void VirtualEndPointStateUpdated(RelationEndPointID endPointID, bool?newChangedState)
 {
     ArgumentUtility.CheckNotNull("endPointID", endPointID);
     _transactionEventSink.RaiseVirtualRelationEndPointStateUpdatedEvent(endPointID, newChangedState);
 }
Exemple #10
0
        public static IVirtualEndPoint CreateVirtualEndPoint(this IRelationEndPointFactory endPointFactory, RelationEndPointID endPointID, bool markDataComplete)
        {
            ArgumentUtility.CheckNotNull("endPointID", endPointID);

            if (!endPointID.Definition.IsVirtual)
            {
                throw new ArgumentException("The RelationEndPointID must identify a virtual end-point.", "endPointID");
            }

            if (endPointID.Definition.Cardinality == CardinalityType.One)
            {
                var virtualObjectEndPoint = endPointFactory.CreateVirtualObjectEndPoint(endPointID);
                if (markDataComplete)
                {
                    virtualObjectEndPoint.MarkDataComplete(null);
                }
                return(virtualObjectEndPoint);
            }
            else
            {
                var collectionEndPoint = endPointFactory.CreateCollectionEndPoint(endPointID);
                if (markDataComplete)
                {
                    collectionEndPoint.MarkDataComplete(new DomainObject[0]);
                }
                return(collectionEndPoint);
            }
        }