コード例 #1
0
ファイル: Bootstrapper.cs プロジェクト: jej666/Skeleton
        public Bootstrapper(IDependencyContainer container)
        {
            container.ThrowIfNull();

            _container = container;
            _container.AddPlugin(new CorePlugin());
        }
コード例 #2
0
        public void Configure(IDependencyContainer container)
        {
            container.ThrowIfNull();

            container.Register
            .Type <IDatabase, Database>(DependencyLifetime.Scoped)
            .Type <IAsyncDatabase, AsyncDatabase>(DependencyLifetime.Scoped);
        }
コード例 #3
0
        public void Configure(IDependencyContainer container)
        {
            container.ThrowIfNull();

            container.Register
            .Type <IAsyncCacheProvider, AsyncMemoryCacheProvider>()
            .Type <ICacheProvider, MemoryCacheProvider>();
        }
コード例 #4
0
ファイル: LoggerPlugin.cs プロジェクト: jej666/Skeleton
        public void Configure(IDependencyContainer container)
        {
            container.ThrowIfNull();

            var configuration = new LoggerConfiguration();

            configuration.Configure();
            (container as DependencyContainer).UnityContainer.AddExtension(new LoggerConstructorInjectionExtension());

            container.Register.Instance <ILoggerFactory>(new LoggerFactory());
        }
コード例 #5
0
ファイル: OrmPlugin.cs プロジェクト: jej666/Skeleton
        public void Configure(IDependencyContainer container)
        {
            container.ThrowIfNull();

            container.Register
            .Type(typeof(IEntityReader <>), typeof(EntityReader <>), DependencyLifetime.Scoped)
            .Type(typeof(IEntityWriter <>), typeof(EntityWriter <>), DependencyLifetime.Scoped)
            .Type(typeof(ICachedEntityReader <>), typeof(CachedEntityReader <>), DependencyLifetime.Scoped)
            .Type(typeof(IEntityMapper <,>), typeof(EntityMapper <,>), DependencyLifetime.Scoped)
            .Type <IStoredProcedureExecutor, StoredProcedureExecutor>(DependencyLifetime.Scoped)
            .Type(typeof(IAsyncEntityReader <>), typeof(AsyncEntityReader <>), DependencyLifetime.Scoped)
            .Type(typeof(IAsyncEntityWriter <>), typeof(AsyncEntityWriter <>), DependencyLifetime.Scoped)
            .Type(typeof(IAsyncCachedEntityReader <>), typeof(AsyncCachedEntityReader <>), DependencyLifetime.Scoped)
            .Type <IAsyncStoredProcedureExecutor, AsyncStoredProcedureExecutor>(DependencyLifetime.Scoped);
        }
コード例 #6
0
        public void Configure(IDependencyContainer container)
        {
            container.ThrowIfNull();

            container.Register.Type <IMetadataProvider, MetadataProvider>();
        }
 /// <summary>
 /// Registers a generator to the resource container with all of the implemented interfaces by the type of resource then generator creates.
 /// </summary>
 /// <param name="container">The container with resources.</param>
 /// <param name="generator">The generator to bind to the container.</param>
 /// <typeparam name="T">Type of value the generator provides when requesting an instance.</typeparam>
 public static void RegisterGeneratorWithInterfaces <T>(this IDependencyContainer container, Func <T> generator)
 {
     container.ThrowIfNull(nameof(container));
     container.RegisterWithInterfaces <T>(new GeneratorBinding <T>(generator));
 }
 /// <summary>
 /// Registers an instance along with all of its implemented interfaces to the resource container.
 /// </summary>
 /// <param name="container">The container with resources.</param>
 /// <param name="instance">Instance resource to bind to the container.</param>
 /// <typeparam name="T">Type of the instance being bound.</typeparam>
 public static void RegisterInstanceWithInterfaces <T>(this IDependencyContainer container, T instance)
 {
     container.ThrowIfNull(nameof(container));
     container.RegisterWithInterfaces <T>(new InstanceBinding <T>(instance));
 }
コード例 #9
0
        public void Configure(IDependencyContainer container)
        {
            container.ThrowIfNull();

            container.Register.Type <IDatabaseConfigurationBuilder, DatabaseConfigurationBuilder>();
        }
コード例 #10
0
        public void Configure(IDependencyContainer container)
        {
            container.ThrowIfNull();

            container.AddPlugins(_corePlugins);
        }