Skip to content

Commit

Permalink
当前租户标识。无效时返回0
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhy committed Aug 22, 2023
1 parent 6c57069 commit 11dcb06
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions XCode/Membership/ITenantSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public class TenantContext
#endif
/// <summary>当前租户上下文</summary>
public static TenantContext Current { get => _Current.Value; set => _Current.Value = value; }

/// <summary>当前租户标识。无效时返回0</summary>
public static Int32 CurrentId => Current?.TenantId ?? 0;
}

/// <summary>多租户助手</summary>
Expand Down
1 change: 1 addition & 0 deletions XCode/Membership/租户.Biz.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ static Tenant()
Meta.Modules.Add<UserModule>();
Meta.Modules.Add<TimeModule>();
Meta.Modules.Add<IPModule>();
Meta.Modules.Add<TenantModule>();
}

/// <summary>验证并修补数据,通过抛出异常的方式提示验证失败。</summary>
Expand Down
3 changes: 2 additions & 1 deletion XCode/Membership/租户关系.Biz.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Runtime.Serialization;
using System.Runtime.Serialization;
using System.Web.Script.Serialization;
using System.Xml.Serialization;
using NewLife;
Expand All @@ -19,6 +19,7 @@ static TenantUser()
Meta.Modules.Add<UserModule>();
Meta.Modules.Add<TimeModule>();
Meta.Modules.Add<IPModule>();
Meta.Modules.Add<TenantModule>();
}

/// <summary>验证并修补数据,通过抛出异常的方式提示验证失败。</summary>
Expand Down
1 change: 1 addition & 0 deletions XCode/Membership/部门.Biz.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ static Department()
Meta.Modules.Add<UserModule>();
Meta.Modules.Add<TimeModule>();
Meta.Modules.Add<IPModule>();
Meta.Modules.Add<TenantModule>();
}

/// <summary>验证数据,通过抛出异常的方式提示验证失败。</summary>
Expand Down

0 comments on commit 11dcb06

Please sign in to comment.