Example #1
0
 public void Configure(IContainerAdapter containerAdapter)
 {
     // Register all of the domain services with the Dependency Injection Container.
     containerAdapter.AddTransient <IDiveLocationService, DiveLocationService>();
     containerAdapter.AddTransient <IDiveTypeService, DiveTypeService>();
     containerAdapter.AddTransient <IUserService, UserService>();
 }
Example #2
0
        public void Configure(IContainerAdapter containerAdapter)
        {
            // Repositories
            containerAdapter.AddGeneric(typeof(IEncapsulatedRepository <>), typeof(EncapsulatedRepository <>));
            containerAdapter.AddTransient <IOrderRepository, OrderRepository>();

            // Domain Services
            containerAdapter.AddTransient <ICustomerService, CustomerService>();
            containerAdapter.AddTransient <IOrderService, OrderService>();

            // Application Services
            containerAdapter.AddTransient <IMyAppService, MyAppService>();
        }
Example #3
0
        /// <summary>
        /// Called by RCommon <see cref="Configure"/> to configure state storage.
        /// </summary>
        /// <param name="containerAdapter">The <see cref="IContainerAdapter"/> instance that can be
        /// used to register state storage components.</param>
        public void Configure(IContainerAdapter containerAdapter)
        {
            if (_customSessionType != null)
            {
                containerAdapter.AddTransient(typeof(ISessionState), _customSessionType);
            }
            else
            {
                containerAdapter.AddTransient <ISessionStateSelector, DefaultSessionStateSelector>();
                containerAdapter.AddTransient <ISessionState, SessionStateWrapper>();
            }

            if (_customLocalStateType != null)
            {
                containerAdapter.AddTransient(typeof(IContextState), _customLocalStateType);
            }
            else
            {
                containerAdapter.AddTransient <IContextStateSelector, DefaultContextStateSelector>();
                containerAdapter.AddTransient <IContextState, ContextStateWrapper>();
            }

            if (_customApplicationStateType != null)
            {
                containerAdapter.AddSingleton(typeof(IApplicationState), _customApplicationStateType);
            }
            else
            {
                containerAdapter.AddSingleton <IApplicationState, ApplicationState>();
            }

            containerAdapter.AddTransient <IStateStorage, StateStorageWrapper>();
        }
Example #4
0
        /// <summary>
        /// Called by RCommon <see cref="Configure"/> to configure data providers.
        /// </summary>
        /// <param name="containerAdapter">The <see cref="IContainerAdapter"/> instance that allows
        /// registering components.</param>
        public void Configure(IContainerAdapter containerAdapter)
        {
            // EF Core Repository
            containerAdapter.AddGeneric(typeof(IEagerFetchingRepository <>), typeof(EFCoreRepository <>));

            // Registered DbContexts
            foreach (var dbContext in _dbContextTypes)
            {
                containerAdapter.AddTransient(Type.GetType(dbContext), Type.GetType(dbContext));
            }
        }
Example #5
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>();
        }
Example #6
0
 public void Configure(IContainerAdapter containerAdapter)
 {
     // Register all of our application services.
     containerAdapter.AddTransient <IDiveService, DiveService>();
     containerAdapter.AddTransient <IApplicationUserService, ApplicationUserService>();
 }
Example #7
0
 public void Configure(IContainerAdapter containerAdapter)
 {
     containerAdapter.AddTransient <IExceptionManager, EntLibExceptionManager>();
     //containerAdapter.AddSingleton<IConfigurationSource, DictionaryConfigurationSource>();
 }
 /// <summary>
 /// Registers default components for RCommon.
 /// </summary>
 private void InitializeDefaults()
 {
     _containerAdapter.AddTransient <IEnvironmentAccessor, EnvironmentAccessor>();
     _containerAdapter.AddScoped <IDataStoreProvider, DataStoreProvider>();
 }