mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 09:15:27 +08:00 
			
		
		
		
	将示例项目类型升级为 .net core 3.1
This commit is contained in:
		@@ -1,11 +1,8 @@
 | 
			
		||||
using FreeSql;
 | 
			
		||||
using FreeSql.DataAnnotations;
 | 
			
		||||
using Microsoft.AspNetCore.Builder;
 | 
			
		||||
using Microsoft.AspNetCore.Hosting;
 | 
			
		||||
using Microsoft.Extensions.Configuration;
 | 
			
		||||
using Microsoft.Extensions.DependencyInjection;
 | 
			
		||||
using Microsoft.Extensions.Logging;
 | 
			
		||||
using Swashbuckle.AspNetCore.Swagger;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
@@ -73,18 +70,7 @@ namespace dbcontext_01
 | 
			
		||||
 | 
			
		||||
        public void ConfigureServices(IServiceCollection services)
 | 
			
		||||
        {
 | 
			
		||||
            services.AddMvc();
 | 
			
		||||
            services.AddSwaggerGen(options =>
 | 
			
		||||
            {
 | 
			
		||||
                options.SwaggerDoc("v1", new Info
 | 
			
		||||
                {
 | 
			
		||||
                    Version = "v1",
 | 
			
		||||
                    Title = "FreeSql.DbContext API"
 | 
			
		||||
                });
 | 
			
		||||
                //options.IncludeXmlComments(xmlPath);
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            services.AddControllersWithViews();
 | 
			
		||||
 | 
			
		||||
            services.AddSingleton<IFreeSql>(Fsql);
 | 
			
		||||
            services.AddSingleton<IFreeSql<long>>(Fsql2);
 | 
			
		||||
@@ -96,24 +82,16 @@ namespace dbcontext_01
 | 
			
		||||
            var sql3 = Fsql.Update<Song>(1).Set(a => a.Create_time.Value.AddHours(1)).ToSql();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
 | 
			
		||||
        public void Configure(IApplicationBuilder app)
 | 
			
		||||
        {
 | 
			
		||||
            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
 | 
			
		||||
            Console.OutputEncoding = Encoding.GetEncoding("GB2312");
 | 
			
		||||
            Console.InputEncoding = Encoding.GetEncoding("GB2312");
 | 
			
		||||
 | 
			
		||||
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
 | 
			
		||||
            loggerFactory.AddDebug();
 | 
			
		||||
 | 
			
		||||
            app.UseHttpMethodOverride(new HttpMethodOverrideOptions { FormFieldName = "X-Http-Method-Override" });
 | 
			
		||||
            app.UseDeveloperExceptionPage();
 | 
			
		||||
            app.UseMvc();
 | 
			
		||||
 | 
			
		||||
            app.UseSwagger();
 | 
			
		||||
            app.UseSwaggerUI(c =>
 | 
			
		||||
            {
 | 
			
		||||
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "FreeSql.RESTful API V1");
 | 
			
		||||
            });
 | 
			
		||||
            app.UseRouting();
 | 
			
		||||
            app.UseEndpoints(a => a.MapControllers());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user