mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-24 18:04:52 +08:00
Upate Demo
This commit is contained in:
parent
a85b3ee18d
commit
e5ad070a65
@ -1,16 +1,46 @@
|
||||
using System;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace OrmTest.Demo
|
||||
namespace OrmTest
|
||||
{
|
||||
public class Demo1_Queryable
|
||||
{
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
Async();
|
||||
}
|
||||
|
||||
private static void Async()
|
||||
{
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("#### Async Start ####");
|
||||
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
|
||||
{
|
||||
DbType = DbType.SqlServer,
|
||||
ConnectionString = Config.ConnectionString,
|
||||
InitKeyType = InitKeyType.Attribute,
|
||||
IsAutoCloseConnection = true,
|
||||
AopEvents = new AopEvents
|
||||
{
|
||||
OnLogExecuting = (sql, p) =>
|
||||
{
|
||||
Console.WriteLine(sql);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var task1 = db.Queryable<Order>().FirstAsync();
|
||||
var task2 = db.Queryable<Order>().Where(it => it.Id == 1).ToListAsync();
|
||||
|
||||
task1.Wait();
|
||||
task2.Wait();
|
||||
|
||||
Console.WriteLine("#### Async End ####");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ namespace OrmTest
|
||||
|
||||
//Demo
|
||||
Demo1_SqlSugarClient.Init();
|
||||
Demo1_Queryable.Init();
|
||||
Democ_GobalFilter.Init();
|
||||
DemoD_DbFirst.Init();
|
||||
DemoE_CodeFirst.Init();
|
||||
|
Loading…
Reference in New Issue
Block a user