From f936c8903a31a33ba03f9e2813f4775ef9d80318 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Mon, 29 Apr 2019 15:17:36 +0800 Subject: [PATCH] Update README.md --- README.md | 64 +++++++++++++++++++++++++++---------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index aa950848d..e6d49b7cb 100644 --- a/README.md +++ b/README.md @@ -22,41 +22,41 @@ Install-Package sqlSugarCore All operations are based on SqlSugarClient ```cs public List GetStudentList() - { - var db= GetInstance(); - var list= db.Queryable().ToList();//Search - return list; - } +{ + var db= GetInstance(); + var list= db.Queryable().ToList();//Search + return list; +} - /// - /// Create SqlSugarClient - /// - /// - private SqlSugarClient GetInstance() +/// +/// Create SqlSugarClient +/// +/// +private SqlSugarClient GetInstance() +{ + SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { - SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() - { - ConnectionString = "Server=.xxxxx", - DbType = DbType.SqlServer, - IsAutoCloseConnection = true, - InitKeyType = InitKeyType.Attribute - }); - //Print sql - db.Aop.OnLogExecuting = (sql, pars) => - { - Console.WriteLine(sql + "\r\n" + db.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value))); - Console.WriteLine(); - }; - return db; - } + ConnectionString = "Server=.xxxxx", + DbType = DbType.SqlServer, + IsAutoCloseConnection = true, + InitKeyType = InitKeyType.Attribute + }); + //Print sql + db.Aop.OnLogExecuting = (sql, pars) => + { + Console.WriteLine(sql + "\r\n" + db.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value))); + Console.WriteLine(); + }; + return db; +} - public class Student - { - [SugarColumn(IsPrimaryKey = true, IsIdentity = true] - public int Id { get; set; } - public int? SchoolId { get; set; } - public string Name { get; set; } - } +public class Student +{ + [SugarColumn(IsPrimaryKey = true, IsIdentity = true] + public int Id { get; set; } + public int? SchoolId { get; set; } + public string Name { get; set; } +} ``` ## SqlSugar's 16 Functions