27 lines
904 B
C#
27 lines
904 B
C#
using Fake.Modularity;
|
|
using Fake.SqlSugarCore;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Oms.Domain;
|
|
using SqlSugar;
|
|
|
|
namespace Oms.SqlSugarCore;
|
|
|
|
[DependsOn(typeof(OmsDomainModule))]
|
|
[DependsOn(typeof(FakeSqlSugarCoreModule))]
|
|
public class OmsSqlSugarCoreModule : FakeModule
|
|
{
|
|
public override void ConfigureServices(ServiceConfigurationContext context)
|
|
{
|
|
context.Services.AddSugarDbContext<OmsDbContext>(options =>
|
|
{
|
|
var configuration = context.Services.GetConfiguration();
|
|
options.ConnectionString = configuration.GetConnectionString("Default")
|
|
?? configuration["ConnectionStrings:Default"]
|
|
?? string.Empty;
|
|
options.DbType = DbType.MySql;
|
|
options.IsAutoCloseConnection = true;
|
|
});
|
|
}
|
|
}
|