SqlSugar/Src/Asp.NetCore2/Json2Sql/Program.cs
2025-02-11 12:17:37 +08:00

52 lines
1.7 KiB
C#

using SqlSugar;
using System;
using System.Collections.Generic;
namespace Test
{
partial class Program
{
static void Main(string[] args)
{
JsonClient jsonToSqlClient = new JsonClient();
jsonToSqlClient.Context = new SqlSugarClient(new ConnectionConfig()
{
DbType = DbType.SqlServer,
IsAutoCloseConnection = true,
ConnectionString = "server=.;uid=sa;pwd=sasa;database=SQLSUGAR4XTEST;Encrypt=True;TrustServerCertificate=True"
});
//jsonToSqlClient.Context = new SqlSugarClient(new ConnectionConfig()
//{
// DbType = DbType.MySql,
// IsAutoCloseConnection = true,
// ConnectionString = "server=localhost;Database=SqlSugar4xTest;Uid=root;Pwd=haosql"
//}); ;
//TestHelper.InitDatabase(jsonToSqlClient);
jsonToSqlClient.Context.Aop.OnLogExecuted = (sql, p) =>
{
Console.WriteLine(UtilMethods.GetNativeSql(sql,p));
};
Insetable01(jsonToSqlClient);
Description(jsonToSqlClient);
FuncText(jsonToSqlClient);
OrderByTest(jsonToSqlClient);
GroupByTest(jsonToSqlClient);
SelectTest(jsonToSqlClient);
JoinTest(jsonToSqlClient);
WhereTest(jsonToSqlClient);
PageTest(jsonToSqlClient);
PageTest2(jsonToSqlClient);
PageTest3(jsonToSqlClient);
Updateable01(jsonToSqlClient);
Deleteable01(jsonToSqlClient);
DynamicLinq(jsonToSqlClient.Context);
Console.WriteLine();
}
}
}