コード例 #1
0
        public override void SetUp()
        {
            base.SetUp();

            _transaction       = ClientTransactionObjectMother.Create();
            _eventSinkWithMock = MockRepository.GenerateStrictMock <IClientTransactionEventSink>();
            _invalidDomainObjectManagerMock = MockRepository.GenerateStrictMock <IInvalidDomainObjectManager> ();
            _dataManagerMock = MockRepository.GenerateStrictMock <IDataManager> ();
            _enlistedDomainObjectManagerMock = MockRepository.GenerateStrictMock <IEnlistedDomainObjectManager> ();
            _persistenceStrategyMock         = MockRepository.GenerateStrictMock <IPersistenceStrategy>();

            _agent = new ObjectLifetimeAgent(
                _transaction,
                _eventSinkWithMock,
                _invalidDomainObjectManagerMock,
                _dataManagerMock,
                _enlistedDomainObjectManagerMock,
                _persistenceStrategyMock);

            _objectID1      = DomainObjectIDs.Order1;
            _domainObject1  = DomainObjectMother.CreateFakeObject(_objectID1);
            _dataContainer1 = DataContainerObjectMother.CreateExisting(_domainObject1);

            _objectID2      = DomainObjectIDs.Order3;
            _domainObject2  = DomainObjectMother.CreateFakeObject(_objectID2);
            _dataContainer2 = DataContainerObjectMother.CreateExisting(_domainObject2);

            _domainObjectCreatorMock       = MockRepository.GenerateStrictMock <IDomainObjectCreator>();
            _typeDefinitionWithCreatorMock = ClassDefinitionObjectMother.CreateClassDefinitionWithTable(
                TestDomainStorageProviderDefinition,
                classType: typeof(OrderItem),
                instanceCreator: _domainObjectCreatorMock);

            _objectIDWithCreatorMock = new ObjectID(_typeDefinitionWithCreatorMock, Guid.NewGuid());
        }
 protected abstract IObjectLoader CreateObjectLoader(
     ClientTransaction constructedTransaction,
     IClientTransactionEventSink eventSink,
     IPersistenceStrategy persistenceStrategy,
     IInvalidDomainObjectManager invalidDomainObjectManager,
     IDataManager dataManager,
     ITransactionHierarchyManager hierarchyManager);
        protected override IObjectLoader CreateObjectLoader(
            ClientTransaction constructedTransaction,
            IClientTransactionEventSink eventSink,
            IPersistenceStrategy persistenceStrategy,
            IInvalidDomainObjectManager invalidDomainObjectManager,
            IDataManager dataManager,
            ITransactionHierarchyManager hierarchyManager)
        {
            ArgumentUtility.CheckNotNull("constructedTransaction", constructedTransaction);
            ArgumentUtility.CheckNotNull("eventSink", eventSink);
            var fetchEnabledPersistenceStrategy =
                ArgumentUtility.CheckNotNullAndType <IFetchEnabledPersistenceStrategy> ("persistenceStrategy", persistenceStrategy);

            ArgumentUtility.CheckNotNull("invalidDomainObjectManager", invalidDomainObjectManager);
            ArgumentUtility.CheckNotNull("dataManager", dataManager);
            ArgumentUtility.CheckNotNull("hierarchyManager", hierarchyManager);

            var loadedObjectDataProvider          = new LoadedObjectDataProvider(dataManager, invalidDomainObjectManager);
            var registrationListener              = new LoadedObjectDataRegistrationListener(eventSink, hierarchyManager);
            var loadedObjectDataRegistrationAgent = new LoadedObjectDataRegistrationAgent(constructedTransaction, dataManager, registrationListener);

            IFetchedRelationDataRegistrationAgent registrationAgent =
                new DelegatingFetchedRelationDataRegistrationAgent(
                    new FetchedRealObjectRelationDataRegistrationAgent(),
                    new FetchedVirtualObjectRelationDataRegistrationAgent(dataManager),
                    new FetchedCollectionRelationDataRegistrationAgent(dataManager));
            var eagerFetcher = new EagerFetcher(registrationAgent);

            return(new FetchEnabledObjectLoader(
                       fetchEnabledPersistenceStrategy,
                       loadedObjectDataRegistrationAgent,
                       loadedObjectDataProvider,
                       eagerFetcher));
        }
        public virtual IDataManager CreateDataManager(
            ClientTransaction constructedTransaction,
            IClientTransactionEventSink eventSink,
            IInvalidDomainObjectManager invalidDomainObjectManager,
            IPersistenceStrategy persistenceStrategy,
            ITransactionHierarchyManager hierarchyManager)
        {
            ArgumentUtility.CheckNotNull("constructedTransaction", constructedTransaction);
            ArgumentUtility.CheckNotNull("eventSink", eventSink);
            ArgumentUtility.CheckNotNull("invalidDomainObjectManager", invalidDomainObjectManager);
            ArgumentUtility.CheckNotNull("persistenceStrategy", persistenceStrategy);
            ArgumentUtility.CheckNotNull("hierarchyManager", hierarchyManager);

            var dataContainerEventListener = CreateDataContainerEventListener(eventSink);

            var delegatingDataManager = new DelegatingDataManager();
            var objectLoader          = CreateObjectLoader(
                constructedTransaction, eventSink, persistenceStrategy, invalidDomainObjectManager, delegatingDataManager, hierarchyManager);

            var endPointManager = CreateRelationEndPointManager(
                constructedTransaction,
                GetEndPointProvider(delegatingDataManager),
                GetLazyLoader(delegatingDataManager),
                eventSink);

            var dataManager = new DataManager(
                constructedTransaction, eventSink, dataContainerEventListener, invalidDomainObjectManager, objectLoader, endPointManager);

            delegatingDataManager.InnerDataManager = dataManager;
            return(dataManager);
        }
コード例 #5
0
        public static T CreateWithComponents <T> (
            Dictionary <Enum, object> applicationData = null,
            IClientTransactionEventBroker eventBroker = null,
            ITransactionHierarchyManager transactionHierarchyManager = null,
            IEnlistedDomainObjectManager enlistedDomainObjectManager = null,
            IInvalidDomainObjectManager invalidDomainObjectManager   = null,
            IPersistenceStrategy persistenceStrategy = null,
            IDataManager dataManager = null,
            IObjectLifetimeAgent objectLifetimeAgent = null,
            IQueryManager queryManager = null,
            ICommitRollbackAgent commitRollbackAgent             = null,
            IEnumerable <IClientTransactionExtension> extensions = null)
            where T : ClientTransaction
        {
            var componentFactoryStub = CreateComponentFactory(
                applicationData,
                eventBroker,
                transactionHierarchyManager,
                enlistedDomainObjectManager,
                invalidDomainObjectManager,
                persistenceStrategy,
                dataManager,
                objectLifetimeAgent,
                queryManager,
                commitRollbackAgent,
                extensions);

            return(CreateWithComponents <T> (componentFactoryStub));
        }
コード例 #6
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);
        }
コード例 #7
0
        public LoadedObjectDataProvider(ILoadedDataContainerProvider loadedDataContainerProvider, IInvalidDomainObjectManager invalidDomainObjectManager)
        {
            ArgumentUtility.CheckNotNull("loadedDataContainerProvider", loadedDataContainerProvider);
            ArgumentUtility.CheckNotNull("invalidDomainObjectManager", invalidDomainObjectManager);

            _loadedDataContainerProvider = loadedDataContainerProvider;
            _invalidDomainObjectManager  = invalidDomainObjectManager;
        }
コード例 #8
0
        public override void SetUp()
        {
            base.SetUp();

            _loadedDataContainerProviderMock = MockRepository.GenerateStrictMock <ILoadedDataContainerProvider> ();
            _invalidDomainObjectManagerMock  = MockRepository.GenerateStrictMock <IInvalidDomainObjectManager>();
            _dataProvider = new LoadedObjectDataProvider(_loadedDataContainerProviderMock, _invalidDomainObjectManagerMock);
        }
 public IObjectLoader CallCreateObjectLoader(
     ClientTransaction constructedTransaction,
     IClientTransactionEventSink eventSink,
     IPersistenceStrategy persistenceStrategy,
     IInvalidDomainObjectManager invalidDomainObjectManager,
     IDataManager dataManager,
     ITransactionHierarchyManager hierarchyManager)
 {
     return(CreateObjectLoader(constructedTransaction, eventSink, persistenceStrategy, invalidDomainObjectManager, dataManager, hierarchyManager));
 }
コード例 #10
0
        public UnlockedParentTransactionContext(
            ClientTransaction parentTransaction,
            IInvalidDomainObjectManager parentInvalidDomainObjectManager,
            IDisposable scope)
        {
            ArgumentUtility.CheckNotNull("parentTransaction", parentTransaction);
            ArgumentUtility.CheckNotNull("parentInvalidDomainObjectManager", parentInvalidDomainObjectManager);
            ArgumentUtility.CheckNotNull("scope", scope);

            _parentTransaction = parentTransaction;
            _parentInvalidDomainObjectManager = parentInvalidDomainObjectManager;

            _scope = scope;
        }
コード例 #11
0
 public static SubClientTransactionComponentFactory Create(
     ClientTransaction parentTransaction,
     IInvalidDomainObjectManager parentInvalidDomainObjectManager,
     IEnlistedDomainObjectManager parentEnlistedDomainObjectManager,
     ITransactionHierarchyManager parentTransactionHierarchyManager,
     IClientTransactionEventSink parentEventSink)
 {
     return(ObjectFactory.Create <SubClientTransactionComponentFactory> (
                true,
                ParamList.Create(
                    parentTransaction,
                    parentInvalidDomainObjectManager,
                    parentEnlistedDomainObjectManager,
                    parentTransactionHierarchyManager,
                    parentEventSink)));
 }
コード例 #12
0
        public override void SetUp()
        {
            base.SetUp();
            _endPointManagerMock            = MockRepository.GenerateStrictMock <IRelationEndPointManager>();
            _transactionEventSinkWithMock   = MockRepository.GenerateMock <IClientTransactionEventSink>();
            _dataContainerMap               = new DataContainerMap(_transactionEventSinkWithMock);
            _invalidDomainObjectManagerMock = MockRepository.GenerateStrictMock <IInvalidDomainObjectManager>();

            _existingDataContainer = CreateExistingDataContainer();
            _existingDomainObject  = (TestDomainBase)_existingDataContainer.DomainObject;

            _newDataContainer = CreateNewDataContainer();
            _newDomainObject  = (TestDomainBase)_newDataContainer.DomainObject;

            _unloadCommand = new UnloadAllCommand(_endPointManagerMock, _dataContainerMap, _invalidDomainObjectManagerMock, _transactionEventSinkWithMock);
        }
コード例 #13
0
        public UnloadAllCommand(
            IRelationEndPointManager relationEndPointManager,
            DataContainerMap dataContainerMap,
            IInvalidDomainObjectManager invalidDomainObjectManager,
            IClientTransactionEventSink transactionEventSink)
        {
            ArgumentUtility.CheckNotNull("relationEndPointManager", relationEndPointManager);
            ArgumentUtility.CheckNotNull("dataContainerMap", dataContainerMap);
            ArgumentUtility.CheckNotNull("invalidDomainObjectManager", invalidDomainObjectManager);
            ArgumentUtility.CheckNotNull("transactionEventSink", transactionEventSink);

            _relationEndPointManager    = relationEndPointManager;
            _dataContainerMap           = dataContainerMap;
            _invalidDomainObjectManager = invalidDomainObjectManager;
            _transactionEventSink       = transactionEventSink;
        }
コード例 #14
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();
        }
コード例 #15
0
        public ParentTransactionContext(ClientTransaction parentTransaction, IInvalidDomainObjectManager parentInvalidDomainObjectManager)
        {
            ArgumentUtility.CheckNotNull("parentTransaction", parentTransaction);
            ArgumentUtility.CheckNotNull("parentInvalidDomainObjectManager", parentInvalidDomainObjectManager);

            if (parentTransaction.IsWriteable)
            {
                throw new ArgumentException(
                          "In order for the parent transaction access to work correctly, the parent transaction needs to be read-only. "
                          + "Using ClientTransaction.CreateSubTransaction() to create a subtransaction automatically sets the parent transaction read-only.",
                          "parentTransaction");
            }

            _parentTransaction = parentTransaction;
            _parentInvalidDomainObjectManager = parentInvalidDomainObjectManager;
        }
コード例 #16
0
        protected override IObjectLoader CreateObjectLoader(
            ClientTransaction constructedTransaction,
            IClientTransactionEventSink eventSink,
            IPersistenceStrategy persistenceStrategy,
            IInvalidDomainObjectManager invalidDomainObjectManager,
            IDataManager dataManager,
            ITransactionHierarchyManager hierarchyManager)
        {
            ArgumentUtility.CheckNotNull("constructedTransaction", constructedTransaction);
            ArgumentUtility.CheckNotNull("eventSink", eventSink);
            ArgumentUtility.CheckNotNull("persistenceStrategy", persistenceStrategy);
            ArgumentUtility.CheckNotNull("invalidDomainObjectManager", invalidDomainObjectManager);
            ArgumentUtility.CheckNotNull("dataManager", dataManager);
            ArgumentUtility.CheckNotNull("hierarchyManager", hierarchyManager);

            return(CreateBasicObjectLoader(constructedTransaction, eventSink, persistenceStrategy, invalidDomainObjectManager, dataManager, hierarchyManager));
        }
        public virtual IObjectLifetimeAgent CreateObjectLifetimeAgent(
            ClientTransaction constructedTransaction,
            IClientTransactionEventSink eventSink,
            IInvalidDomainObjectManager invalidDomainObjectManager,
            IDataManager dataManager,
            IEnlistedDomainObjectManager enlistedDomainObjectManager,
            IPersistenceStrategy persistenceStrategy)
        {
            ArgumentUtility.CheckNotNull("constructedTransaction", constructedTransaction);
            ArgumentUtility.CheckNotNull("eventSink", eventSink);
            ArgumentUtility.CheckNotNull("invalidDomainObjectManager", invalidDomainObjectManager);
            ArgumentUtility.CheckNotNull("dataManager", dataManager);
            ArgumentUtility.CheckNotNull("enlistedDomainObjectManager", enlistedDomainObjectManager);
            ArgumentUtility.CheckNotNull("persistenceStrategy", persistenceStrategy);

            return(new ObjectLifetimeAgent(
                       constructedTransaction, eventSink, invalidDomainObjectManager, dataManager, enlistedDomainObjectManager, persistenceStrategy));
        }
        public virtual IQueryManager CreateQueryManager(
            ClientTransaction constructedTransaction,
            IClientTransactionEventSink eventSink,
            IInvalidDomainObjectManager invalidDomainObjectManager,
            IPersistenceStrategy persistenceStrategy,
            IDataManager dataManager,
            ITransactionHierarchyManager hierarchyManager)
        {
            ArgumentUtility.CheckNotNull("constructedTransaction", constructedTransaction);
            ArgumentUtility.CheckNotNull("eventSink", eventSink);
            ArgumentUtility.CheckNotNull("invalidDomainObjectManager", invalidDomainObjectManager);
            ArgumentUtility.CheckNotNull("persistenceStrategy", persistenceStrategy);
            ArgumentUtility.CheckNotNull("dataManager", dataManager);

            var objectLoader = CreateObjectLoader(
                constructedTransaction, eventSink, persistenceStrategy, invalidDomainObjectManager, dataManager, hierarchyManager);

            return(new QueryManager(persistenceStrategy, objectLoader, eventSink));
        }
コード例 #19
0
        protected SubClientTransactionComponentFactory(
            ClientTransaction parentTransaction,
            IInvalidDomainObjectManager parentInvalidDomainObjectManager,
            IEnlistedDomainObjectManager parentEnlistedDomainObjectManager,
            ITransactionHierarchyManager parentHierarchyManager,
            IClientTransactionEventSink parentEventSink)
        {
            ArgumentUtility.CheckNotNull("parentTransaction", parentTransaction);
            ArgumentUtility.CheckNotNull("parentInvalidDomainObjectManager", parentInvalidDomainObjectManager);
            ArgumentUtility.CheckNotNull("parentEnlistedDomainObjectManager", parentEnlistedDomainObjectManager);
            ArgumentUtility.CheckNotNull("parentHierarchyManager", parentHierarchyManager);
            ArgumentUtility.CheckNotNull("parentEventSink", parentEventSink);

            _parentTransaction = parentTransaction;
            _parentInvalidDomainObjectManager  = parentInvalidDomainObjectManager;
            _parentEnlistedDomainObjectManager = parentEnlistedDomainObjectManager;
            _parentHierarchyManager            = parentHierarchyManager;
            _parentEventSink = parentEventSink;
        }
 private object CallCreateBasicObjectLoader(
     SubClientTransactionComponentFactory factory,
     TestableClientTransaction constructedTransaction,
     IClientTransactionEventSink eventSink,
     IPersistenceStrategy persistenceStrategy,
     IInvalidDomainObjectManager invalidDomainObjectManager,
     IDataManager dataManager,
     ITransactionHierarchyManager hierarchyManager)
 {
     return(PrivateInvoke.InvokeNonPublicMethod(
                factory,
                "CreateBasicObjectLoader",
                constructedTransaction,
                eventSink,
                persistenceStrategy,
                invalidDomainObjectManager,
                dataManager,
                hierarchyManager));
 }
コード例 #21
0
        public ObjectLifetimeAgent(
            ClientTransaction clientTransaction,
            IClientTransactionEventSink eventSink,
            IInvalidDomainObjectManager invalidDomainObjectManager,
            IDataManager dataManager,
            IEnlistedDomainObjectManager enlistedDomainObjectManager,
            IPersistenceStrategy persistenceStrategy)
        {
            ArgumentUtility.CheckNotNull("clientTransaction", clientTransaction);
            ArgumentUtility.CheckNotNull("eventSink", eventSink);
            ArgumentUtility.CheckNotNull("invalidDomainObjectManager", invalidDomainObjectManager);
            ArgumentUtility.CheckNotNull("dataManager", dataManager);
            ArgumentUtility.CheckNotNull("persistenceStrategy", persistenceStrategy);

            _clientTransaction           = clientTransaction;
            _eventSink                   = eventSink;
            _invalidDomainObjectManager  = invalidDomainObjectManager;
            _dataManager                 = dataManager;
            _enlistedDomainObjectManager = enlistedDomainObjectManager;
            _persistenceStrategy         = persistenceStrategy;
        }
        public override void SetUp()
        {
            base.SetUp();

            _parentTransaction = new TestableClientTransaction();
            _parentInvalidDomainObjectManagerStub  = MockRepository.GenerateStub <IInvalidDomainObjectManager> ();
            _parentEnlistedDomainObjectManagerStub = MockRepository.GenerateStub <IEnlistedDomainObjectManager> ();
            _parentTransactionHierarchyManagerStub = MockRepository.GenerateStub <ITransactionHierarchyManager> ();
            _parentTransactionHierarchyManagerStub
            .Stub(stub => stub.TransactionHierarchy)
            .Return(MockRepository.GenerateStub <IClientTransactionHierarchy>());
            _parentEventSink = MockRepository.GenerateStub <IClientTransactionEventSink>();

            _factory = SubClientTransactionComponentFactory.Create(
                _parentTransaction,
                _parentInvalidDomainObjectManagerStub,
                _parentEnlistedDomainObjectManagerStub,
                _parentTransactionHierarchyManagerStub,
                _parentEventSink);

            _fakeConstructedTransaction = new TestableClientTransaction();
        }
コード例 #23
0
        protected virtual IObjectLoader CreateBasicObjectLoader(
            ClientTransaction constructedTransaction,
            IClientTransactionEventSink eventSink,
            IPersistenceStrategy persistenceStrategy,
            IInvalidDomainObjectManager invalidDomainObjectManager,
            IDataManager dataManager,
            ITransactionHierarchyManager hierarchyManager)
        {
            ArgumentUtility.CheckNotNull("constructedTransaction", constructedTransaction);
            ArgumentUtility.CheckNotNull("eventSink", eventSink);
            ArgumentUtility.CheckNotNull("persistenceStrategy", persistenceStrategy);
            ArgumentUtility.CheckNotNull("invalidDomainObjectManager", invalidDomainObjectManager);
            ArgumentUtility.CheckNotNull("dataManager", dataManager);
            ArgumentUtility.CheckNotNull("hierarchyManager", hierarchyManager);

            var loadedObjectDataProvider          = new LoadedObjectDataProvider(dataManager, invalidDomainObjectManager);
            var registrationListener              = new LoadedObjectDataRegistrationListener(eventSink, hierarchyManager);
            var loadedObjectDataRegistrationAgent = new LoadedObjectDataRegistrationAgent(constructedTransaction, dataManager, registrationListener);

            return(new ObjectLoader(
                       persistenceStrategy,
                       loadedObjectDataRegistrationAgent,
                       loadedObjectDataProvider));
        }
コード例 #24
0
        public static IClientTransactionComponentFactory CreateComponentFactory(
            Dictionary <Enum, object> applicationData = null,
            IClientTransactionEventBroker eventBroker = null,
            ITransactionHierarchyManager transactionHierarchyManager = null,
            IEnlistedDomainObjectManager enlistedDomainObjectManager = null,
            IInvalidDomainObjectManager invalidDomainObjectManager   = null,
            IPersistenceStrategy persistenceStrategy = null,
            IDataManager dataManager = null,
            IObjectLifetimeAgent objectLifetimeAgent = null,
            IQueryManager queryManager = null,
            ICommitRollbackAgent commitRollbackAgent             = null,
            IEnumerable <IClientTransactionExtension> extensions = null)
        {
            applicationData             = applicationData ?? new Dictionary <Enum, object>();
            transactionHierarchyManager = transactionHierarchyManager ?? MockRepository.GenerateStub <ITransactionHierarchyManager>();
            enlistedDomainObjectManager = enlistedDomainObjectManager ?? MockRepository.GenerateStub <IEnlistedDomainObjectManager>();
            invalidDomainObjectManager  = invalidDomainObjectManager ?? MockRepository.GenerateStub <IInvalidDomainObjectManager>();
            persistenceStrategy         = persistenceStrategy ?? MockRepository.GenerateStub <IPersistenceStrategy>();
            dataManager         = dataManager ?? MockRepository.GenerateStub <IDataManager>();
            objectLifetimeAgent = objectLifetimeAgent ?? MockRepository.GenerateStub <IObjectLifetimeAgent>();
            eventBroker         = eventBroker ?? MockRepository.GenerateStub <IClientTransactionEventBroker>();
            queryManager        = queryManager ?? MockRepository.GenerateStub <IQueryManager>();
            commitRollbackAgent = commitRollbackAgent ?? MockRepository.GenerateStub <ICommitRollbackAgent>();
            extensions          = extensions ?? Enumerable.Empty <IClientTransactionExtension>();

            var componentFactoryStub = MockRepository.GenerateStub <IClientTransactionComponentFactory>();

            componentFactoryStub.Stub(stub => stub.CreateApplicationData(Arg <ClientTransaction> .Is.Anything)).Return(applicationData);
            componentFactoryStub
            .Stub(stub => stub.CreateEventBroker(Arg <ClientTransaction> .Is.Anything))
            .Return(eventBroker);
            componentFactoryStub
            .Stub(stub => stub.CreateTransactionHierarchyManager(Arg <ClientTransaction> .Is.Anything, Arg <IClientTransactionEventSink> .Is.Anything))
            .Return(transactionHierarchyManager);
            componentFactoryStub.Stub(stub => stub.CreateEnlistedObjectManager(Arg <ClientTransaction> .Is.Anything)).Return(enlistedDomainObjectManager);
            componentFactoryStub
            .Stub(stub => stub.CreateInvalidDomainObjectManager(Arg <ClientTransaction> .Is.Anything, Arg <IClientTransactionEventSink> .Is.Anything))
            .Return(invalidDomainObjectManager);
            componentFactoryStub.Stub(stub => stub.CreatePersistenceStrategy(Arg <ClientTransaction> .Is.Anything)).Return(persistenceStrategy);
            componentFactoryStub
            .Stub(stub => stub.CreateDataManager(
                      Arg <ClientTransaction> .Is.Anything,
                      Arg <IClientTransactionEventSink> .Is.Anything,
                      Arg <IInvalidDomainObjectManager> .Is.Anything,
                      Arg <IPersistenceStrategy> .Is.Anything,
                      Arg <ITransactionHierarchyManager> .Is.Anything))
            .Return(dataManager);
            componentFactoryStub
            .Stub(
                stub =>
                stub.CreateObjectLifetimeAgent(
                    Arg <ClientTransaction> .Is.Anything,
                    Arg <IClientTransactionEventSink> .Is.Anything,
                    Arg <IInvalidDomainObjectManager> .Is.Anything,
                    Arg <IDataManager> .Is.Anything,
                    Arg <IEnlistedDomainObjectManager> .Is.Anything,
                    Arg <IPersistenceStrategy> .Is.Anything))
            .Return(objectLifetimeAgent);
            componentFactoryStub
            .Stub(stub => stub.CreateQueryManager(
                      Arg <ClientTransaction> .Is.Anything,
                      Arg <IClientTransactionEventSink> .Is.Anything,
                      Arg <IInvalidDomainObjectManager> .Is.Anything,
                      Arg <IPersistenceStrategy> .Is.Anything,
                      Arg <IDataManager> .Is.Anything,
                      Arg <ITransactionHierarchyManager> .Is.Anything))
            .Return(queryManager);
            componentFactoryStub
            .Stub(stub => stub.CreateCommitRollbackAgent(
                      Arg <ClientTransaction> .Is.Anything,
                      Arg <IClientTransactionEventSink> .Is.Anything,
                      Arg <IPersistenceStrategy> .Is.Anything,
                      Arg <IDataManager> .Is.Anything))
            .Return(commitRollbackAgent);
            componentFactoryStub.Stub(stub => stub.CreateExtensions(Arg <ClientTransaction> .Is.Anything)).Return(extensions);
            return(componentFactoryStub);
        }
コード例 #25
0
        protected override IObjectLoader CreateObjectLoader(ClientTransaction constructedTransaction, IClientTransactionEventSink eventSink, IPersistenceStrategy persistenceStrategy, IInvalidDomainObjectManager invalidDomainObjectManager, IDataManager dataManager, ITransactionHierarchyManager hierarchyManager)
        {
            var objectLoader = base.CreateObjectLoader(constructedTransaction, eventSink, persistenceStrategy, invalidDomainObjectManager, dataManager, hierarchyManager);

            return(_factory(objectLoader));
        }
 protected override IObjectLoader CreateObjectLoader(ClientTransaction constructedTransaction, IClientTransactionEventSink eventSink, IPersistenceStrategy persistenceStrategy, IInvalidDomainObjectManager invalidDomainObjectManager, IDataManager dataManager, ITransactionHierarchyManager hierarchyManager)
 {
     throw new NotImplementedException();
 }
コード例 #27
0
 public override IQueryManager CreateQueryManager(ClientTransaction constructedTransaction, IClientTransactionEventSink eventSink, IInvalidDomainObjectManager invalidDomainObjectManager, IPersistenceStrategy persistenceStrategy, IDataManager dataManager, ITransactionHierarchyManager hierarchyManager)
 {
     return(_queryManager);
 }