更新框架,增加云库搜索模块
This commit is contained in:
1 parent
8526e5e0d2
commit
f2caec6083
192 files changed
+3626
-804
No files matched your search
@@ -0,0 +1,27 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace MAX.Framework.DependencyInjection
|
||||
{
|
||||
public static class FreeSqlDB
|
||||
{
|
||||
public static IServiceCollection AddFreeSqlDB(this IServiceCollection services)
|
||||
{
|
||||
Func<IServiceProvider, IFreeSql> fsqlFactory = r =>
|
||||
{
|
||||
var config = r.GetRequiredService<IConfiguration>();
|
||||
var connection = config.GetConnectionString("DefaultConnection");
|
||||
IFreeSql fsql = new FreeSql.FreeSqlBuilder()
|
||||
.UseConnectionString(FreeSql.DataType.MySql, connection)
|
||||
.UseAdoConnectionPool(true)
|
||||
.Build();
|
||||
return fsql;
|
||||
};
|
||||
services.AddSingleton<IFreeSql>(fsqlFactory);
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user