mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-18 20:08:15 +08:00
## v0.1.13
- 修改 连接池内部 Ping Timeout 值暂定 5秒; - 优化 初始化时若数据库超时,则放弃预热; - FreeSql.Repository 下增加 ISelect.FromRepository 扩展方法,实现分表的多表查询; - 增加 FreeSql.Repository Autofac 泛型注入,可利用实现全局过滤+分表分库; - 补充 GuidRepository 插入数据时,根据 filter 参数设定进行数据验证;
This commit is contained in:
@ -1,9 +1,11 @@
|
||||
using FreeSql;
|
||||
using Autofac;
|
||||
using Autofac.Extensions.DependencyInjection;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using restful.Entitys;
|
||||
using Swashbuckle.AspNetCore.Swagger;
|
||||
using System;
|
||||
using System.Text;
|
||||
@ -23,8 +25,10 @@ namespace repository_01 {
|
||||
public IConfiguration Configuration { get; }
|
||||
public IFreeSql Fsql { get; }
|
||||
|
||||
public void ConfigureServices(IServiceCollection services) {
|
||||
public IServiceProvider ConfigureServices(IServiceCollection services) {
|
||||
|
||||
services.AddSingleton<IFreeSql>(Fsql);
|
||||
//services.AddTransient(s => s.)
|
||||
|
||||
services.AddMvc();
|
||||
services.AddSwaggerGen(options => {
|
||||
@ -34,6 +38,16 @@ namespace repository_01 {
|
||||
});
|
||||
//options.IncludeXmlComments(xmlPath);
|
||||
});
|
||||
|
||||
var builder = new ContainerBuilder();
|
||||
|
||||
builder.RegisterFreeRepository<Song>(a => a.Id == 1);
|
||||
builder.RegisterFreeGuidRepository<Song>(a => a.Id == 1, oldname => $"{oldname}_{DateTime.Now.Year}");
|
||||
|
||||
builder.Populate(services);
|
||||
var container = builder.Build();
|
||||
|
||||
return new AutofacServiceProvider(container);
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) {
|
||||
|
Reference in New Issue
Block a user