Dapper. Rainbow is simple to use and dapper. rainbow is used

Source: Internet
Author: User

Dapper. Rainbow is simple to use and dapper. rainbow is used
1. Dapper Introduction A highly efficient micro-ORM. 2. Dapper. Rainbow Dapper extensions implement Dynamic insertion and update in this extension, which is useful for Dynamic objects and can be used to create fewer anemia entity classes. 3. Dynamic is a double-edged sword, which increases efficiency and increases the chance of errors. It is necessary to use it properly. Iv. Use of Dapper. Rainbow

// Api name public virtual long Insert ([Dynamic] dynamic data); public long InsertOrUpdate ([Dynamic] dynamic data); public int Update (TId id, [Dynamic] dynamic data); // indicates the column Code new ConfigContext (). init (). job. insert (dynamic T); new ConfigContext (). init (). job. insertOrUpdate (dynamic T); new ConfigContext (). init (). job. update (dynamic T) public class ConfigContext: Database <ConfigContext> {protected readon Ly string _ connectionString; protected IDbConnection _ connection; public IDbConnection Connection => _ connection ?? (_ Connection = GetOpenConncetion (); // Table name public Table <Site> Site {get; set;} public Table <Job> Job {get; set ;} public ConfigContext () {_ connectionString = System. configuration. configurationManager. connectionStrings ["Config_connectionString"]. connectionString;} public ConfigContext Init () {return Init (Connection as System. data. common. dbConnection, commandTimeout: 200);} public IDbConnection GetOpenConncetion () {var connection = new SQLiteConnection (_ connectionString); connection. open (); return connection ;}}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.