mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
Add questdb
This commit is contained in:
parent
21c911842e
commit
dc96069dff
@ -19,9 +19,9 @@ namespace OrmTest
|
|||||||
IsAutoCloseConnection = true
|
IsAutoCloseConnection = true
|
||||||
});
|
});
|
||||||
|
|
||||||
var list=db.Queryable<Order>().Take(2).ToList();
|
var list = db.Queryable<Order>().Take(2).ToList();
|
||||||
Console.WriteLine(db.Queryable<Order>().Count());
|
Console.WriteLine(db.Queryable<Order>().Count());
|
||||||
var i=db.RestApi().BulkCopy(list);
|
var i = db.RestApi().BulkCopy(list);
|
||||||
Console.WriteLine(db.Queryable<Order>().Count());
|
Console.WriteLine(db.Queryable<Order>().Count());
|
||||||
Console.WriteLine("--2---");
|
Console.WriteLine("--2---");
|
||||||
var i2 = db.RestApi().BulkCopy(list.First());
|
var i2 = db.RestApi().BulkCopy(list.First());
|
||||||
@ -33,6 +33,44 @@ namespace OrmTest
|
|||||||
var i4 = db.RestApi().BulkCopyAsync(list.First()).GetAwaiter().GetResult();
|
var i4 = db.RestApi().BulkCopyAsync(list.First()).GetAwaiter().GetResult();
|
||||||
Console.WriteLine(db.Queryable<Order>().Count());
|
Console.WriteLine(db.Queryable<Order>().Count());
|
||||||
Console.WriteLine("--1---");
|
Console.WriteLine("--1---");
|
||||||
|
Demo1(db);
|
||||||
|
Demo2(db);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Demo1(SqlSugarClient db)
|
||||||
|
{
|
||||||
|
db.CodeFirst.InitTables<BulkCopyTest>();
|
||||||
|
List<BulkCopyTest> bulkCopyTests = new List<BulkCopyTest>();
|
||||||
|
bulkCopyTests.Add(new BulkCopyTest() { Id = SnowFlakeSingle.Instance.NextId(), DateTime = DateTime.Now });
|
||||||
|
bulkCopyTests.Add(new BulkCopyTest() { Id = SnowFlakeSingle.Instance.NextId(), DateTime = DateTime.Now });
|
||||||
|
var rows = db.RestApi().BulkCopy(bulkCopyTests);
|
||||||
|
var list2 = db.Queryable<BulkCopyTest>().Take(2).ToList();
|
||||||
|
}
|
||||||
|
private static void Demo2(SqlSugarClient db)
|
||||||
|
{
|
||||||
|
db.CodeFirst.InitTables<BulkCopyTest2>();
|
||||||
|
List<BulkCopyTest2> bulkCopyTests = new List<BulkCopyTest2>();
|
||||||
|
bulkCopyTests.Add(new BulkCopyTest2() { Id = SnowFlakeSingle.Instance.NextId(), DateTime = DateTime.Now });
|
||||||
|
bulkCopyTests.Add(new BulkCopyTest2() { Id = SnowFlakeSingle.Instance.NextId(), DateTime = DateTime.Now });
|
||||||
|
var rows = db.RestApi().BulkCopy(bulkCopyTests);
|
||||||
|
var list2 = db.Queryable<BulkCopyTest2>().Take(2).ToList();
|
||||||
|
}
|
||||||
|
public class BulkCopyTest
|
||||||
|
{
|
||||||
|
[SugarColumn(IsPrimaryKey =true)]
|
||||||
|
public long Id { get; set; }
|
||||||
|
public DateTime DateTime { get; set; }
|
||||||
|
[SugarColumn(IsIgnore =true)]
|
||||||
|
public string aaa { get; }
|
||||||
|
}
|
||||||
|
public class BulkCopyTest2
|
||||||
|
{
|
||||||
|
[SugarColumn(IsPrimaryKey = true)]
|
||||||
|
public long Id { get; set; }
|
||||||
|
[SugarColumn(ColumnName ="dt")]
|
||||||
|
public DateTime DateTime { get; set; }
|
||||||
|
[SugarColumn(IsIgnore = true)]
|
||||||
|
public string aaa { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user