mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-05 17:37:58 +08:00
Add DorisTest
This commit is contained in:
parent
92e4dad0b5
commit
9312b26feb
14
Src/Asp.NetCore2/DorisTest/DorisTest.csproj
Normal file
14
Src/Asp.NetCore2/DorisTest/DorisTest.csproj
Normal file
@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SqlSugar\SqlSugar.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
57
Src/Asp.NetCore2/DorisTest/Program.cs
Normal file
57
Src/Asp.NetCore2/DorisTest/Program.cs
Normal file
@ -0,0 +1,57 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
|
||||
namespace OrmTest
|
||||
{
|
||||
|
||||
public class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
|
||||
var db = DbHelper.GetNewDb();
|
||||
db.Open();
|
||||
db.Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Helper class for database operations
|
||||
/// 数据库操作的辅助类
|
||||
/// </summary>
|
||||
public class DbHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Database connection string
|
||||
/// 数据库连接字符串
|
||||
/// </summary>
|
||||
public readonly static string Connection = "data source=139.170.74.9;port=9030;database=test;user id=root;password=1q!1q!;pooling=true;charset=utf8;";
|
||||
|
||||
/// <summary>
|
||||
/// Get a new SqlSugarClient instance with specific configurations
|
||||
/// 获取具有特定配置的新 SqlSugarClient 实例
|
||||
/// </summary>
|
||||
/// <returns>SqlSugarClient instance</returns>
|
||||
public static SqlSugarClient GetNewDb()
|
||||
{
|
||||
var db = new SqlSugarClient(new ConnectionConfig()
|
||||
{
|
||||
IsAutoCloseConnection = true,
|
||||
DbType = DbType.Doris,
|
||||
ConnectionString = Connection,
|
||||
LanguageType = LanguageType.Default//Set language
|
||||
|
||||
},
|
||||
it => {
|
||||
// Logging SQL statements and parameters before execution
|
||||
// 在执行前记录 SQL 语句和参数
|
||||
it.Aop.OnLogExecuting = (sql, para) =>
|
||||
{
|
||||
Console.WriteLine(UtilMethods.GetNativeSql(sql, para));
|
||||
};
|
||||
});
|
||||
return db;
|
||||
}
|
||||
}
|
||||
}
|
@ -72,6 +72,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "2VastbaseTest", "VastbaseTe
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SqlSugar.QuestDb.RestAPI", "SqlSugar.QuestDb.RestApi\SqlSugar.QuestDb.RestAPI.csproj", "{6DED25D0-660B-468A-AD61-7646345145F5}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DorisTest", "DorisTest\DorisTest.csproj", "{7AB57075-AAAC-462D-BD5E-D87B69270EDF}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -454,6 +456,18 @@ Global
|
||||
{6DED25D0-660B-468A-AD61-7646345145F5}.Release|ARM32.Build.0 = Release|Any CPU
|
||||
{6DED25D0-660B-468A-AD61-7646345145F5}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{6DED25D0-660B-468A-AD61-7646345145F5}.Release|x86.Build.0 = Release|Any CPU
|
||||
{7AB57075-AAAC-462D-BD5E-D87B69270EDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7AB57075-AAAC-462D-BD5E-D87B69270EDF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7AB57075-AAAC-462D-BD5E-D87B69270EDF}.Debug|ARM32.ActiveCfg = Debug|Any CPU
|
||||
{7AB57075-AAAC-462D-BD5E-D87B69270EDF}.Debug|ARM32.Build.0 = Debug|Any CPU
|
||||
{7AB57075-AAAC-462D-BD5E-D87B69270EDF}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{7AB57075-AAAC-462D-BD5E-D87B69270EDF}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{7AB57075-AAAC-462D-BD5E-D87B69270EDF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7AB57075-AAAC-462D-BD5E-D87B69270EDF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{7AB57075-AAAC-462D-BD5E-D87B69270EDF}.Release|ARM32.ActiveCfg = Release|Any CPU
|
||||
{7AB57075-AAAC-462D-BD5E-D87B69270EDF}.Release|ARM32.Build.0 = Release|Any CPU
|
||||
{7AB57075-AAAC-462D-BD5E-D87B69270EDF}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{7AB57075-AAAC-462D-BD5E-D87B69270EDF}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
Loading…
Reference in New Issue
Block a user