From eb5f76fe8bbb314eaf8817f6e97f0bbb428d5be2 Mon Sep 17 00:00:00 2001 From: ArthurWang Date: Sat, 15 May 2021 17:41:15 +0800 Subject: [PATCH] Update README.md --- README.md | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 64b48cd..565eb72 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,37 @@ # Dapper.Contrib.BulkInsert -Make ClickHouse available to Dapper.Dapper's extensions. ->ClickHouse is a free analytic DBMS for big data. + +Easy to use Dapper batch insert, support MySQL, SQLServer, ClickHouse + + +## Demo + +### Entity + +```c# + [Table("TestUser")] + public class TestUser + { + [Date] + public DateTime ResisterDate { get; set; } + public DateTime ResisterTime { get; set; } + public string Name { get; set; } + public int Age { get; set; } + } +} +``` +### InsertBulk +```c# +MySqlConnection conn = new MySqlConnection("server=127.0.0.1;Database=Demo;Uid=root;Pwd=root"); +conn.Open(); +conn.Execute("CREATE TABLE IF NOT EXISTS TestUser (ResisterDate Date, ResisterTime DateTime, Name varchar(200), Age int(11)) ENGINE=InnoDB"); +var user = new TestUser() { ResisterDate = DateTime.Now, ResisterTime = DateTime.Now, Age = 18, Name = "Jack" }; +var user2 = new TestUser() { ResisterDate = DateTime.Now, ResisterTime = DateTime.Now, Age = 18, Name = "Tom" }; + +var users = new List() { user, user2 }; +conn.InsertBulk(users); +``` + + Dapper: https://github.com/StackExchange/Dapper