private IRealObjectEndPointSyncState _syncState; // keeps track of whether this end-point is synchronised with the opposite end point

        public RealObjectEndPoint(
            ClientTransaction clientTransaction,
            RelationEndPointID id,
            DataContainer foreignKeyDataContainer,
            IRelationEndPointProvider endPointProvider,
            IClientTransactionEventSink transactionEventSink)
            : base(
                ArgumentUtility.CheckNotNull("clientTransaction", clientTransaction),
                ArgumentUtility.CheckNotNull("id", id))
        {
            ArgumentUtility.CheckNotNull("foreignKeyDataContainer", foreignKeyDataContainer);
            ArgumentUtility.CheckNotNull("endPointProvider", endPointProvider);
            ArgumentUtility.CheckNotNull("transactionEventSink", transactionEventSink);

            if (ID.Definition.IsVirtual)
            {
                throw new ArgumentException("End point ID must refer to a non-virtual end point.", "id");
            }

            var propertyDefinition = GetPropertyDefinition();

            if (foreignKeyDataContainer.ID != id.ObjectID)
            {
                throw new ArgumentException("The foreign key data container must be from the same object as the end point definition.", "foreignKeyDataContainer");
            }

            _foreignKeyDataContainer = foreignKeyDataContainer;
            _endPointProvider        = endPointProvider;
            _transactionEventSink    = transactionEventSink;

            _propertyDefinition = propertyDefinition;
            _syncState          = new UnknownRealObjectEndPointSyncState(_endPointProvider);
        }
 protected RealObjectEndPoint(FlattenedDeserializationInfo info)
     : base(info)
 {
     _foreignKeyDataContainer = info.GetValueForHandle <DataContainer> ();
     _propertyDefinition      = GetPropertyDefinition();
     _endPointProvider        = info.GetValueForHandle <IRelationEndPointProvider> ();
     _transactionEventSink    = info.GetValueForHandle <IClientTransactionEventSink> ();
     _syncState = info.GetValueForHandle <IRealObjectEndPointSyncState> ();
 }
Esempio n. 3
0
        public override void SetUp()
        {
            base.SetUp();

            _endPointID = RelationEndPointObjectMother.CreateRelationEndPointID(DomainObjectIDs.OrderTicket1, "Order");
            _foreignKeyDataContainer  = DataContainer.CreateForExisting(_endPointID.ObjectID, null, pd => pd.DefaultValue);
            _endPointProviderStub     = MockRepository.GenerateStub <IRelationEndPointProvider>();
            _transactionEventSinkStub = MockRepository.GenerateStub <IClientTransactionEventSink>();
            _syncStateMock            = MockRepository.GenerateStrictMock <IRealObjectEndPointSyncState> ();

            _endPoint = new RealObjectEndPoint(
                TestableClientTransaction, _endPointID, _foreignKeyDataContainer, _endPointProviderStub, _transactionEventSinkStub);
            PrivateInvoke.SetNonPublicField(_endPoint, "_syncState", _syncStateMock);
        }
 public void ResetSyncState()
 {
     _syncState = new UnknownRealObjectEndPointSyncState(_endPointProvider);
 }
 public void MarkUnsynchronized()
 {
     _syncState = new UnsynchronizedRealObjectEndPointSyncState();
 }
 public void MarkSynchronized()
 {
     _syncState = new SynchronizedRealObjectEndPointSyncState(_endPointProvider, _transactionEventSink);
 }