feat: 完成多租户saas框架搭建

This commit is contained in:
橙子
2024-01-21 18:11:04 +08:00
parent 68c1d59638
commit 2013aa5db8
19 changed files with 295 additions and 266 deletions

View File

@@ -22,7 +22,7 @@ namespace Yi.Framework.SqlSugarCore
/// <summary>
/// SqlSugar 客户端
/// </summary>
public ISqlSugarClient SqlSugarClient { get; }
public ISqlSugarClient SqlSugarClient { get; private set; }
public ICurrentUser CurrentUser => LazyServiceProvider.GetRequiredService<ICurrentUser>();
private IAbpLazyServiceProvider LazyServiceProvider { get; }
@@ -36,8 +36,13 @@ namespace Yi.Framework.SqlSugarCore
protected virtual bool IsSoftDeleteFilterEnabled => DataFilter?.IsEnabled<ISoftDelete>() ?? false;
public IEntityChangeEventHelper EntityChangeEventHelper => LazyServiceProvider.LazyGetService<IEntityChangeEventHelper>(NullEntityChangeEventHelper.Instance);
protected DbConnOptions Options => LazyServiceProvider.LazyGetRequiredService<IOptions<DbConnOptions>>().Value;
public DbConnOptions Options => LazyServiceProvider.LazyGetRequiredService<IOptions<DbConnOptions>>().Value;
public void SetSqlSugarClient(ISqlSugarClient sqlSugarClient)
{
SqlSugarClient=sqlSugarClient;
}
public SqlSugarDbContext(IAbpLazyServiceProvider lazyServiceProvider)
{
LazyServiceProvider = lazyServiceProvider;