SQL_ORM framework

【LINQ】
using (SqlConnection conn = new SqlConnection(conStr)) {
string sql = $@"select * from vip_e_coupons_policy where blocno=@blocno";
}

CRUD: conn.Execute (sql)
check: conn.Query <T> (sql)

SingleOrDefault (): returns a single particular element value sequence; if no such element is found, a default value.

————————————————————————————————————————————————————————————
【EF CORE】

 API:https://docs.microsoft.com/zh-cn/ef/core/querying/raw-sql?tdsourcetag=s_pctim_aiomsg
————————————————————————————————————————————————————————————

[Dapper]
Dapper is a lightweight ORM (Object Relational Mapping Object-Relational Mapping) in .Net framework
added Dapper package of Nugets

————————————————————————————————————————————————————————————
【Sugar】

API:http://www.codeisbug.com/Doc/8/1165

-------------------------------------------------- ----------
persistence mechanism is in data conversion between the persistent state and transient state.
Data that is stored (e.g., memory objects) to be permanently stored in the memory device (e.g., disk).
Persistence is the major application in the database, or disk file, XML data files, and so on objects stored in the storage memory.

———————————————————————————————————————————————————————————— 

Delete
When you no longer need the table, with [drop]
when you still want to leave this table, but when you want to delete all records, use [] truncate
when you want to delete the part of the record, with the [delete]

清空表
重置自增字段
truncate table hotel_area restart IDENTITY;
truncate table hotel_device restart IDENTITY;
truncate table hotel_trade_area restart IDENTITY;
truncate table hotel_hot_word restart IDENTITY;
truncate table hotel_optimal restart IDENTITY;
truncate table hotel_pic restart IDENTITY;
truncate table hotel_area;
truncate table hotel_device;
truncate table hotel_trade_area;
truncate table hotel_hot_word;
truncate table hotel_optimal;
truncate table hotel_pic;

Guess you like

Origin www.cnblogs.com/mobaiyu/p/11161778.html