|
@@ -17,7 +17,7 @@ public class DbContext<T> where T : class, new()
|
|
|
IsAutoCloseConnection = true,//开启自动释放模式和EF原理一样我就不多解释了
|
|
|
|
|
|
});
|
|
|
- //调式代码 用来打印SQL
|
|
|
+ //调式代码 用来打印SQL
|
|
|
Db.Aop.OnLogExecuting = (sql, pars) =>
|
|
|
{
|
|
|
Console.WriteLine(sql + "\r\n" +
|
|
@@ -28,7 +28,7 @@ public class DbContext<T> where T : class, new()
|
|
|
}
|
|
|
//注意:不能写成静态的
|
|
|
public SqlSugarClient Db;//用来处理事务多表查询和复杂的操作
|
|
|
- public SimpleClient<T> CurrentDb { get { return Db.GetSimpleClient<T>(); } }//用来操作当前表的数据
|
|
|
+ public SimpleClient<T> CurrentDb { get { return Db.GetSimpleClient<T>(); } }//用来操作当前表的数据
|
|
|
|
|
|
public SimpleClient<fdc_pm_occupation> fdc_pm_occupationDb { get { return Db.GetSimpleClient<fdc_pm_occupation>(); } }//用来处理fdc_pm_occupation表的常用操作
|
|
|
public SimpleClient<fdc_pmzsystemUser> fdc_pmzsystemUserDb { get { return Db.GetSimpleClient<fdc_pmzsystemUser>(); } }//用来处理fdc_pmzsystemUser表的常用操作
|
|
@@ -257,7 +257,7 @@ public class DbContext<T> where T : class, new()
|
|
|
/// 根据主键查询
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
- public virtual List<T> GetById(dynamic id)
|
|
|
+ public virtual T GetById(dynamic id)
|
|
|
{
|
|
|
return CurrentDb.GetById(id);
|
|
|
}
|
|
@@ -346,7 +346,5 @@ public class DbContext<T> where T : class, new()
|
|
|
}
|
|
|
|
|
|
|
|
|
- //自已扩展更多方法
|
|
|
+ //自已扩展更多方法
|
|
|
}
|
|
|
-
|
|
|
-
|