mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-01 10:10:16 +08:00
Update Demo
This commit is contained in:
parent
1eb6a448a0
commit
723517693e
46
Src/Asp.Net/SqlServerTest/Demos/9_Aop.cs
Normal file
46
Src/Asp.Net/SqlServerTest/Demos/9_Aop.cs
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace OrmTest.Demo
|
||||||
|
{
|
||||||
|
public class Aop
|
||||||
|
{
|
||||||
|
|
||||||
|
public static void Init()
|
||||||
|
{
|
||||||
|
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer, IsAutoCloseConnection = true });
|
||||||
|
db.Aop.OnLogExecuted = (sql, pars) =>
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
db.Aop.OnLogExecuting = (sql, pars) =>
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
db.Aop.OnError = (exp) =>
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
db.Aop.OnExecutingChangeSql = (sql, pars) =>
|
||||||
|
{
|
||||||
|
return new KeyValuePair<string, SugarParameter[]>(sql,pars);
|
||||||
|
};
|
||||||
|
|
||||||
|
db.Queryable<CMStudent>().ToList();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
db.Queryable<CMStudent>().AS(" ' ").ToList();
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -45,6 +45,7 @@ namespace OrmTest
|
|||||||
OrmTest.Demo.Filter.Init();
|
OrmTest.Demo.Filter.Init();
|
||||||
OrmTest.Demo.ComplexModel.Init();
|
OrmTest.Demo.ComplexModel.Init();
|
||||||
OrmTest.Demo.CodeFirst.Init();
|
OrmTest.Demo.CodeFirst.Init();
|
||||||
|
OrmTest.Demo.Aop.Init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,7 @@
|
|||||||
<Compile Include="Demos\8_JoinSql.cs" />
|
<Compile Include="Demos\8_JoinSql.cs" />
|
||||||
<Compile Include="Demos\5_DbFirst.cs" />
|
<Compile Include="Demos\5_DbFirst.cs" />
|
||||||
<Compile Include="Demos\4_Delete.cs" />
|
<Compile Include="Demos\4_Delete.cs" />
|
||||||
|
<Compile Include="Demos\9_Aop.cs" />
|
||||||
<Compile Include="Demos\CS_TeacherStudent.cs" />
|
<Compile Include="Demos\CS_TeacherStudent.cs" />
|
||||||
<Compile Include="Demos\DemoBase.cs" />
|
<Compile Include="Demos\DemoBase.cs" />
|
||||||
<Compile Include="Demos\3_Insert.cs" />
|
<Compile Include="Demos\3_Insert.cs" />
|
||||||
|
@ -487,7 +487,7 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region DbMaintenance
|
#region Db Maintenance
|
||||||
public virtual IDbMaintenance DbMaintenance
|
public virtual IDbMaintenance DbMaintenance
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@ -503,7 +503,7 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Entity Methods
|
#region Entity Maintenance
|
||||||
[Obsolete("Use SqlSugarClient.EntityMaintenance")]
|
[Obsolete("Use SqlSugarClient.EntityMaintenance")]
|
||||||
public virtual EntityMaintenance EntityProvider
|
public virtual EntityMaintenance EntityProvider
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user