コード例 #1
0
ファイル: Startup.cs プロジェクト: kuroblog/WebAPI
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            #region iochelper
            IocHelper.ServiceCollection.Configure <HisOptions>(Configuration.GetSection(nameof(HisOptions)));
            IocHelper.AddScoped <IHisProxyInterface, HisSocketProxy>();
            IocHelper.AddScoped <IHisProxyInterface, HisWebSvcProxy>();
            IocHelper.AddScoped <ProxyFactory>();
            IocHelper.AddScoped <IProxyService, ProxyService>();

            ZeroApplication.Initialize();
            #endregion

            #region standard
            //services.AddOptions();
            //services.Configure<HisOptions>(Configuration.GetSection(nameof(HisOptions)));

            //services.AddScoped<IHisProxyInterface, HisSocketProxy>();
            //services.AddScoped<IHisProxyInterface, HisWebSvcProxy>();
            //services.AddScoped<ProxyFactory>();
            //services.AddScoped<IProxyService, ProxyService>();
            #endregion

            var i = new AutoRegister() as IAutoRegister;
            i.Initialize();
            i.AutoRegist();

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            //services.AddScoped<IFoo, Foo>();
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="services"></param>
        /// <remarks>This method gets called by the runtime. Use this method to add services to the container.</remarks>
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            IocHelper.ServiceCollection.Configure <HospProxySettings>(Configuration.GetSection(nameof(HospProxySettings)));
            IocHelper.AddScoped <IHospProxyInterface, HisSocketProxy>();
            IocHelper.AddScoped <IHospProxyInterface, HisWebSvcProxy>();
            IocHelper.AddScoped <HisProxyFactory>();
            IocHelper.AddScoped <IProxyService, ProxyService>();

            ZeroApplication.Initialize();

            IAutoRegister iar = new AutoRegister();

            iar.Initialize();
            iar.AutoRegist();
        }