mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 09:15:27 +08:00 
			
		
		
		
	源代码改用vs默认格式化
This commit is contained in:
		@@ -7,61 +7,71 @@ using Swashbuckle.AspNetCore.Swagger;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Text;
 | 
			
		||||
 | 
			
		||||
namespace restful {
 | 
			
		||||
	public class Startup {
 | 
			
		||||
		public Startup(IConfiguration configuration, ILoggerFactory loggerFactory) {
 | 
			
		||||
			Configuration = configuration;
 | 
			
		||||
namespace restful
 | 
			
		||||
{
 | 
			
		||||
    public class Startup
 | 
			
		||||
    {
 | 
			
		||||
        public Startup(IConfiguration configuration, ILoggerFactory loggerFactory)
 | 
			
		||||
        {
 | 
			
		||||
            Configuration = configuration;
 | 
			
		||||
 | 
			
		||||
			Fsql = new FreeSql.FreeSqlBuilder()
 | 
			
		||||
				.UseConnectionString(FreeSql.DataType.Sqlite, @"Data Source=|DataDirectory|\document.db;Attachs=xxxtb.db;Pooling=true;Max Pool Size=10")
 | 
			
		||||
				.UseAutoSyncStructure(true)
 | 
			
		||||
				.Build();
 | 
			
		||||
            Fsql = new FreeSql.FreeSqlBuilder()
 | 
			
		||||
                .UseConnectionString(FreeSql.DataType.Sqlite, @"Data Source=|DataDirectory|\document.db;Attachs=xxxtb.db;Pooling=true;Max Pool Size=10")
 | 
			
		||||
                .UseAutoSyncStructure(true)
 | 
			
		||||
                .Build();
 | 
			
		||||
 | 
			
		||||
			Fsql.Aop.CurdAfter = (s, e) => {
 | 
			
		||||
				if (e.ElapsedMilliseconds > 200) {
 | 
			
		||||
					//记录日志
 | 
			
		||||
					//发送短信给负责人
 | 
			
		||||
				}
 | 
			
		||||
			};
 | 
			
		||||
            Fsql.Aop.CurdAfter = (s, e) =>
 | 
			
		||||
            {
 | 
			
		||||
                if (e.ElapsedMilliseconds > 200)
 | 
			
		||||
                {
 | 
			
		||||
                    //记录日志
 | 
			
		||||
                    //发送短信给负责人
 | 
			
		||||
                }
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
			//Fsql.Aop.Where = (s, e) => {
 | 
			
		||||
			//	if (e.Parameters[0]?.ToString() == "1")
 | 
			
		||||
			//		e.IsCancel = true;
 | 
			
		||||
			//};
 | 
			
		||||
		}
 | 
			
		||||
            //Fsql.Aop.Where = (s, e) => {
 | 
			
		||||
            //	if (e.Parameters[0]?.ToString() == "1")
 | 
			
		||||
            //		e.IsCancel = true;
 | 
			
		||||
            //};
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		public IConfiguration Configuration { get; }
 | 
			
		||||
		public IFreeSql Fsql { get; }
 | 
			
		||||
        public IConfiguration Configuration { get; }
 | 
			
		||||
        public IFreeSql Fsql { get; }
 | 
			
		||||
 | 
			
		||||
		public void ConfigureServices(IServiceCollection services) {
 | 
			
		||||
			services.AddSingleton<IFreeSql>(Fsql);
 | 
			
		||||
        public void ConfigureServices(IServiceCollection services)
 | 
			
		||||
        {
 | 
			
		||||
            services.AddSingleton<IFreeSql>(Fsql);
 | 
			
		||||
 | 
			
		||||
			services.AddMvc();
 | 
			
		||||
			services.AddSwaggerGen(options => {
 | 
			
		||||
				options.SwaggerDoc("v1", new Info {
 | 
			
		||||
					Version = "v1",
 | 
			
		||||
					Title = "FreeSql.RESTful API"
 | 
			
		||||
				});
 | 
			
		||||
				//options.IncludeXmlComments(xmlPath);
 | 
			
		||||
			});
 | 
			
		||||
		}
 | 
			
		||||
            services.AddMvc();
 | 
			
		||||
            services.AddSwaggerGen(options =>
 | 
			
		||||
            {
 | 
			
		||||
                options.SwaggerDoc("v1", new Info
 | 
			
		||||
                {
 | 
			
		||||
                    Version = "v1",
 | 
			
		||||
                    Title = "FreeSql.RESTful API"
 | 
			
		||||
                });
 | 
			
		||||
                //options.IncludeXmlComments(xmlPath);
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) {
 | 
			
		||||
			Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
 | 
			
		||||
			Console.OutputEncoding = Encoding.GetEncoding("GB2312");
 | 
			
		||||
			Console.InputEncoding = Encoding.GetEncoding("GB2312");
 | 
			
		||||
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
 | 
			
		||||
        {
 | 
			
		||||
            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
 | 
			
		||||
            Console.OutputEncoding = Encoding.GetEncoding("GB2312");
 | 
			
		||||
            Console.InputEncoding = Encoding.GetEncoding("GB2312");
 | 
			
		||||
 | 
			
		||||
			loggerFactory.AddConsole(Configuration.GetSection("Logging"));
 | 
			
		||||
			loggerFactory.AddDebug();
 | 
			
		||||
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
 | 
			
		||||
            loggerFactory.AddDebug();
 | 
			
		||||
 | 
			
		||||
			app.UseHttpMethodOverride(new HttpMethodOverrideOptions { FormFieldName = "X-Http-Method-Override" });
 | 
			
		||||
			app.UseDeveloperExceptionPage();
 | 
			
		||||
			app.UseMvc();
 | 
			
		||||
            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.UseSwagger();
 | 
			
		||||
            app.UseSwaggerUI(c =>
 | 
			
		||||
            {
 | 
			
		||||
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "FreeSql.RESTful API V1");
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user