Ejemplo n.º 1
0
        private object[] _deserializedData; // only used for deserialization

        public DataManager(
            ClientTransaction clientTransaction,
            IClientTransactionEventSink transactionEventSink,
            IDataContainerEventListener dataContainerEventListener,
            IInvalidDomainObjectManager invalidDomainObjectManager,
            IObjectLoader objectLoader,
            IRelationEndPointManager relationEndPointManager)
        {
            ArgumentUtility.CheckNotNull("clientTransaction", clientTransaction);
            ArgumentUtility.CheckNotNull("transactionEventSink", transactionEventSink);
            ArgumentUtility.CheckNotNull("dataContainerEventListener", dataContainerEventListener);
            ArgumentUtility.CheckNotNull("invalidDomainObjectManager", invalidDomainObjectManager);
            ArgumentUtility.CheckNotNull("objectLoader", objectLoader);
            ArgumentUtility.CheckNotNull("relationEndPointManager", relationEndPointManager);

            _clientTransaction          = clientTransaction;
            _transactionEventSink       = transactionEventSink;
            _dataContainerEventListener = dataContainerEventListener;
            _invalidDomainObjectManager = invalidDomainObjectManager;
            _objectLoader            = objectLoader;
            _relationEndPointManager = relationEndPointManager;

            _dataContainerMap       = new DataContainerMap(_transactionEventSink);
            _domainObjectStateCache = new DomainObjectStateCache(clientTransaction);
        }
Ejemplo n.º 2
0
        public override void SetUp()
        {
            base.SetUp();

            _transaction     = ClientTransaction.CreateRootTransaction();
            _cachingListener = new DomainObjectStateCache(_transaction);

            _existingOrder     = (Order)LifetimeService.GetObject(_transaction, DomainObjectIDs.Order1, false);
            _newOrder          = (Order)LifetimeService.NewObject(_transaction, typeof(Order), ParamList.Empty);
            _notYetLoadedOrder = (Order)LifetimeService.GetObjectReference(_transaction, DomainObjectIDs.Order3);
        }
Ejemplo n.º 3
0
        public void GetState_Invalidated_AfterCommit()
        {
            var subTransaction = _transaction.CreateSubTransaction();

            subTransaction.EnsureDataAvailable(_existingOrder.ID);
            subTransaction.ExecuteInScope(() => _existingOrder.OrderNumber++);

            var cachingListener   = new DomainObjectStateCache(subTransaction);
            var stateBeforeChange = cachingListener.GetState(_existingOrder.ID);

            subTransaction.Commit();
            var stateAfterChange = cachingListener.GetState(_existingOrder.ID);

            Assert.That(stateBeforeChange, Is.EqualTo(StateType.Changed));
            Assert.That(stateAfterChange, Is.EqualTo(StateType.Unchanged));
        }
Ejemplo n.º 4
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();
        }