diff --git a/AOP.md b/AOP.md index d11074b..1c588ce 100644 --- a/AOP.md +++ b/AOP.md @@ -8,10 +8,10 @@ FreeSql 支持简单的类似功能: ```csharp fsql.Aop.CurdAfter += (s, e) => { - if (e.ElapsedMilliseconds > 200) { - //记录日志 - //发送短信给负责人 - } + if (e.ElapsedMilliseconds > 200) { + //记录日志 + //发送短信给负责人 + } }; ``` diff --git a/骚操作.md b/骚操作.md index 4ca769a..a609c78 100644 --- a/骚操作.md +++ b/骚操作.md @@ -170,8 +170,8 @@ fsql.Select().IncludeMany(a => a.Comment.Take(10)); ```csharp //定义临时类,也可以是 Dto 类 class Dto { - public int TypeId { get; set; } - public List GoodsList { get; set; } + public int TypeId { get; set; } + public List GoodsList { get; set; } } //查询 Goods 商品表,分类1、分类2、分类3 各10条数据 @@ -427,16 +427,16 @@ fsql.Aop.CurdAfter += (s, e) => { ```csharp fsql.Aop.AuditValue += (s, e) => { - if (e.Column.CsType == typeof(long) - && e.Property.GetCustomAttribute(false) != null - && e.Value?.ToString() == 0) - e.Value = new Snowflake().GetId(); + if (e.Column.CsType == typeof(long) + && e.Property.GetCustomAttribute(false) != null + && e.Value?.ToString() == 0) + e.Value = new Snowflake().GetId(); }; class Order { - [Snowflake] - public long Id { get; set; } - //... + [Snowflake] + public long Id { get; set; } + //... } ``` @@ -455,19 +455,19 @@ using FreeSql; using (var conn = new SqlConnection(...)) { - IFreeSql fsql = conn.GetIFreeSql(); - fsql.CodeFirst.IsNoneCommandParameter = true; - fsql.CodeFirst.IsSyncStructureToUpper = true; - fsql.Aop.CommandBefore += (_, e) => Trace.WriteLine(e.Command.CommandText); - //以上整个程序只需要设置一次 + IFreeSql fsql = conn.GetIFreeSql(); + fsql.CodeFirst.IsNoneCommandParameter = true; + fsql.CodeFirst.IsSyncStructureToUpper = true; + fsql.Aop.CommandBefore += (_, e) => Trace.WriteLine(e.Command.CommandText); + //以上整个程序只需要设置一次 - conn.Select().Where(...).ToList(); + conn.Select().Where(...).ToList(); - conn.Insert(new T {}).ExecuteAffrows(); - conn.Update().SetSource(new T {}).ExecuteAffrows(); - conn.InsertOrUpdate().SetSource(new T {}).ExecuteAffrows(); + conn.Insert(new T {}).ExecuteAffrows(); + conn.Update().SetSource(new T {}).ExecuteAffrows(); + conn.InsertOrUpdate().SetSource(new T {}).ExecuteAffrows(); - conn.Delete().Where(...).ExecuteAffrows(); + conn.Delete().Where(...).ExecuteAffrows(); } ```