From 392442f2ea7a49ea110ff9ed634dfa94b02caa9f Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Fri, 2 Feb 2018 14:50:34 +0800 Subject: [PATCH] Update README.md --- README.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/README.md b/README.md index cca740b5f..bbdedc640 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,51 @@ Install-Package sqlSugarCore ## Here's the history version https://github.com/sunkaixuan/SqlSugar/tree/master + + +#Demo +``` +//创建一个DbContext类,使用DbSet(或者SimpleClient) +public class DbContext +{ + public SqlSugarClient db; + public DbContext() + { + db = new SqlSugarClient(new ConnectionConfig() + { + ConnectionString = Config.ConnectionString, + DbType = DbType.Oracle, + IsAutoCloseConnection = true + }); + } + public SimpleClient StudentDb { get { return new SimpleClient(db); } } + public SimpleClient SchoolDb { get { return new SimpleClient(db); } } +} +public class Business : DbContext +{ + public void GetAll() + { + + //use db get student list + List list= db.Queryable().ToList(); + + //use StudentDb get student list + List list2=StudentDb.GetList(); + //StudentDb.GetById + //StudentDb.Delete + //StudentDb.Update + //StudentDb.Insert + //StudentDb.GetPageList + //.... + //SchoolDb.GetById + //.... + + } +} +``` + + + ## 1. Query ### 1.1 Create Connection