mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 13:06:50 +08:00
Update demo
This commit is contained in:
parent
06d4f13599
commit
e0f15ec15d
@ -50,8 +50,7 @@ namespace OrmTest
|
||||
{
|
||||
if (context == null)
|
||||
{
|
||||
var configId = typeof(T).GetCustomAttribute<TenantAttribute>().configId;
|
||||
Context = db.GetConnection(configId);
|
||||
Context = db.GetConnectionWithAttr<T>();
|
||||
Context.CodeFirst.InitTables<T>();
|
||||
}
|
||||
}
|
||||
|
@ -637,7 +637,7 @@ namespace SqlSugar
|
||||
public SqlSugarProvider GetConnectionWithAttr<T>()
|
||||
{
|
||||
var attr = typeof(T).GetCustomAttribute<TenantAttribute>();
|
||||
Check.ExceptionEasy("not TenantAttribute", "不存在特性 TenantAttribute");
|
||||
Check.ExceptionEasy(attr==null,"not TenantAttribute", "不存在特性 TenantAttribute");
|
||||
var configId = attr.configId;
|
||||
return this.GetConnection(configId);
|
||||
}
|
||||
|
@ -33,5 +33,10 @@ namespace SqlSugar
|
||||
{
|
||||
throw new SqlSugarException(ErrorMessage.GetThrowMessage(enMessage, cnMessage));
|
||||
}
|
||||
public static void ExceptionEasy(bool isException, string enMessage, string cnMessage)
|
||||
{
|
||||
if (isException)
|
||||
throw new SqlSugarException(ErrorMessage.GetThrowMessage(enMessage, cnMessage));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user