mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-20 02:29:39 +08:00
Update demo
This commit is contained in:
@@ -1,50 +1,64 @@
|
||||
|
||||
using SqlSugar;
|
||||
using System;
|
||||
|
||||
namespace OrmTest
|
||||
{
|
||||
class Program
|
||||
|
||||
public class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
_1_CodeFirst.Init();
|
||||
_2_DbFirst.Init();
|
||||
_3_EasyQuery.Init();
|
||||
_4_JoinQuery.Init();
|
||||
_5_PageQuery.Init();
|
||||
_6_NavQuery.Init();
|
||||
_7_GroupQuery.Init();
|
||||
_8_Insert.Init();
|
||||
_9_Update.Init();
|
||||
_a1_Delete.Init();
|
||||
_a2_Sql.Init();
|
||||
_a3_Merge.Init();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper class for database operations
|
||||
/// 数据库操作的辅助类
|
||||
/// </summary>
|
||||
public class DbHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Set up config.cs file and start directly F5
|
||||
/// 设置Config.cs文件直接F5启动例子
|
||||
/// Database connection string
|
||||
/// 数据库连接字符串
|
||||
/// </summary>
|
||||
/// <param name="args"></param>
|
||||
static void Main(string[] args)
|
||||
public readonly static string Connection = "server=.;uid=sa;pwd=sasa;database=SqlSugar5Demo";
|
||||
|
||||
/// <summary>
|
||||
/// Get a new SqlSugarClient instance with specific configurations
|
||||
/// 获取具有特定配置的新 SqlSugarClient 实例
|
||||
/// </summary>
|
||||
/// <returns>SqlSugarClient instance</returns>
|
||||
public static SqlSugarClient GetNewDb()
|
||||
{
|
||||
|
||||
//Demo
|
||||
Demo0_SqlSugarClient.Init();
|
||||
Demo1_Queryable.Init();
|
||||
Demo2_Updateable.Init();
|
||||
Demo3_Insertable.Init();
|
||||
Demo4_Deleteable.Init();
|
||||
DemoN_SplitTable.Init();
|
||||
DemoM_UnitOfWork.Init();
|
||||
DemoL_Snowflake.Init();
|
||||
Demo5_SqlQueryable.Init();
|
||||
Demo6_Queue.Init();
|
||||
Demo7_Ado.Init();
|
||||
Demo8_Saveable.Init();
|
||||
Demo9_EntityMain.Init();
|
||||
DemoA_DbMain.Init();
|
||||
DemoB_Aop.Init();
|
||||
DemoC_GobalFilter.Init();
|
||||
DemoD_DbFirst.Init();;
|
||||
DemoE_CodeFirst.Init();
|
||||
DemoF_Utilities.Init();
|
||||
DemoG_SimpleClient.Init();
|
||||
DemoJ_Report.Init();
|
||||
//Unit test
|
||||
//NewUnitTest.Init();
|
||||
var db = new SqlSugarClient(new ConnectionConfig()
|
||||
{
|
||||
IsAutoCloseConnection = true,
|
||||
DbType = DbType.SqlServer,
|
||||
ConnectionString = Connection,
|
||||
LanguageType=LanguageType.Default//Set language
|
||||
|
||||
//Rest Data
|
||||
NewUnitTest.RestData();
|
||||
|
||||
Console.WriteLine("all successfully.");
|
||||
Console.ReadKey();
|
||||
},
|
||||
it => {
|
||||
// Logging SQL statements and parameters before execution
|
||||
// 在执行前记录 SQL 语句和参数
|
||||
it.Aop.OnLogExecuting = (sql, para) =>
|
||||
{
|
||||
Console.WriteLine(UtilMethods.GetNativeSql(sql, para));
|
||||
};
|
||||
});
|
||||
return db;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user