コード例 #1
0
        /// <summary>
        /// Configures <see cref="UnitOfWorkScope"/> settings.
        /// </summary>
        /// <param name="containerAdapter">The <see cref="IContainerAdapter"/> instance.</param>
        public void Configure(IContainerAdapter containerAdapter)
        {
            // Transaction Management
            containerAdapter.AddScoped <IUnitOfWorkManager, UnitOfWorkManager>();
            containerAdapter.AddTransient <IUnitOfWorkTransactionManager, UnitOfWorkTransactionManager>();
            UnitOfWorkSettings.AutoCompleteScope = _autoCompleteScope;
            UnitOfWorkSettings.DefaultIsolation  = _defaultIsolation;

            // Factory for Unit Of Work
            containerAdapter.AddTransient <IUnitOfWork, UnitOfWork>();
            containerAdapter.AddTransient <Func <IUnitOfWork> >(x => () => x.GetService <IUnitOfWork>());
            containerAdapter.AddTransient <ICommonFactory <IUnitOfWork>, CommonFactory <IUnitOfWork> >();

            // Factory for Unit Of Work Scope
            //containerAdapter.AddTransient<TransactionMode, TransactionMode>();
            containerAdapter.AddTransient <IUnitOfWorkScope, UnitOfWorkScope>();
            containerAdapter.AddTransient <IUnitOfWorkScopeFactory, UnitOfWorkScopeFactory>();
        }
コード例 #2
0
 /// <summary>
 /// Registers default components for RCommon.
 /// </summary>
 private void InitializeDefaults()
 {
     _containerAdapter.AddTransient <IEnvironmentAccessor, EnvironmentAccessor>();
     _containerAdapter.AddScoped <IDataStoreProvider, DataStoreProvider>();
 }