コード例 #1
0
        public void Setup()
        {
            var service = new ServicesBuilder();

            _untity    = service.GetService <IUntityFunction>();
            _db        = service.GetService <WorkToolEntity>();
            _work      = service.GetService <IWork>();
            _sqlClient = service.GetService <ISqlClient>();
        }
コード例 #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        //設定應用程式請求
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, WorkToolEntity dbContext)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            //設定文件路由
            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "Swagger");
                c.RoutePrefix = string.Empty;
            });

            //dbContext.Database.EnsureCreated();

            app.UseStaticFiles();

            app.UseRouting();

            app.UseAuthorization();
            //跨域處理
            app.UseCors("AllowSpecificOrigins");

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });
        }
コード例 #3
0
 public WorkServers(WorkToolEntity db, IUntityFunction untity)
 {
     _db     = db;
     _untity = untity;
 }