예제 #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();
        }