var connstr = configurationmanager.connectionstrings["Dbconnstr"]. ConnectionString;
SqlContext db = new SqlContext (CONNSTR);
List Query
var list1 = db. Getlist<config> (s = s.id > 5);
var list2 = db. Getlist<config> ("select * from Config where ID > @id", NULL, New SqlParameter ("@id", 5));
var list3 = db. Query<config> (). Where (s = = s.id > 5). ToList ();
Multi-Criteria Query
var query = db. Query<config> ();
Query. Where (s = = S.name = = "B");
Query. Where (s = = s.id > 5);
var result = query. ToList ();
Paging Query
var PAGERESULT1 = db. Getpageresult<config> (New SQL. pagehelper.pagebase {PageIndex = 0, PageSize = ten}, s = = S.id, true);
var pageResult2 = db. Getpageresult<config> (New SQL. pagehelper.pagebase {PageIndex = 0, PageSize = ten}, "select * from Config", "Id ASC");
var PAGERESULT3 = db. Query<config> (). Topageresult (New SQL. pagehelper.pagebase {PageIndex = 0, PageSize = ten}, s = = S.id, true);
Insert
int row1 = db. Insert<config> (new Config {Name = "a"});
int row2 = db. Insertbatch<config> (New List<config> {
New Config {Name = "B"},
New Config {Name = "C"}
});
Update
int update1 = db. Update<config> (new Config {ID = 10033, name= "AA"});
int update2 = db. Query<config> (). Set (s = = S.name, "AAA"). Where (s = = S.id = 10033). Update ();
Delete
int delete1 = db. Delete<config> (s = = S.id = = 10033);
int delete2 = db. Query<config> (). Where (s = = S.id = 10033). Delete ();
int delete3 = db. Delete<config> (new Config {ID = 10035});
If you find that the above statement is not supported, download the latest version