mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-06-28 13:34:32 +08:00
Add Vastbase test
This commit is contained in:
parent
f8b1e4e716
commit
e140955e19
@ -68,6 +68,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SqlSugar.TDengineCore", "Sq
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "1TDengineTest", "TDengineTest\1TDengineTest.csproj", "{AFBF6813-DA87-4621-9659-5D123234CDDF}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "1TDengineTest", "TDengineTest\1TDengineTest.csproj", "{AFBF6813-DA87-4621-9659-5D123234CDDF}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "2VastbaseTest", "VastbaseTest\2VastbaseTest.csproj", "{FA0F2233-7BD5-49A0-8333-BA471509F2D7}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -426,6 +428,18 @@ Global
|
|||||||
{AFBF6813-DA87-4621-9659-5D123234CDDF}.Release|ARM32.Build.0 = Release|Any CPU
|
{AFBF6813-DA87-4621-9659-5D123234CDDF}.Release|ARM32.Build.0 = Release|Any CPU
|
||||||
{AFBF6813-DA87-4621-9659-5D123234CDDF}.Release|x86.ActiveCfg = Release|Any CPU
|
{AFBF6813-DA87-4621-9659-5D123234CDDF}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
{AFBF6813-DA87-4621-9659-5D123234CDDF}.Release|x86.Build.0 = Release|Any CPU
|
{AFBF6813-DA87-4621-9659-5D123234CDDF}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{FA0F2233-7BD5-49A0-8333-BA471509F2D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{FA0F2233-7BD5-49A0-8333-BA471509F2D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{FA0F2233-7BD5-49A0-8333-BA471509F2D7}.Debug|ARM32.ActiveCfg = Debug|Any CPU
|
||||||
|
{FA0F2233-7BD5-49A0-8333-BA471509F2D7}.Debug|ARM32.Build.0 = Debug|Any CPU
|
||||||
|
{FA0F2233-7BD5-49A0-8333-BA471509F2D7}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{FA0F2233-7BD5-49A0-8333-BA471509F2D7}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{FA0F2233-7BD5-49A0-8333-BA471509F2D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{FA0F2233-7BD5-49A0-8333-BA471509F2D7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{FA0F2233-7BD5-49A0-8333-BA471509F2D7}.Release|ARM32.ActiveCfg = Release|Any CPU
|
||||||
|
{FA0F2233-7BD5-49A0-8333-BA471509F2D7}.Release|ARM32.Build.0 = Release|Any CPU
|
||||||
|
{FA0F2233-7BD5-49A0-8333-BA471509F2D7}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{FA0F2233-7BD5-49A0-8333-BA471509F2D7}.Release|x86.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
12
Src/Asp.NetCore2/VastbaseTest/2VastbaseTest.csproj
Normal file
12
Src/Asp.NetCore2/VastbaseTest/2VastbaseTest.csproj
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="SqlSugarCore" Version="5.1.4.115-preview13" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
68
Src/Asp.NetCore2/VastbaseTest/Program.cs
Normal file
68
Src/Asp.NetCore2/VastbaseTest/Program.cs
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace OrmTest
|
||||||
|
{
|
||||||
|
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
var db = DbHelper.GetNewDb();
|
||||||
|
|
||||||
|
db.CodeFirst.InitTables<DataType1>();
|
||||||
|
db.Insertable(new DataType1() { Id = 1,id2=Convert.ToDecimal(1.2),id3="aa" }).ExecuteCommand();
|
||||||
|
var list=db.Queryable<DataType1>().ToList();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DataType1
|
||||||
|
{
|
||||||
|
[SugarColumn(ColumnDataType ="integer")]
|
||||||
|
public int Id { get; set; }
|
||||||
|
[SugarColumn(ColumnDataType ="money",IsNullable =true)]
|
||||||
|
public decimal id2 { get; set; }
|
||||||
|
[SugarColumn(ColumnDataType = "varchar2", IsNullable = true)]
|
||||||
|
public string id3 { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper class for database operations
|
||||||
|
/// 数据库操作的辅助类
|
||||||
|
/// </summary>
|
||||||
|
public class DbHelper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Database connection string
|
||||||
|
/// 数据库连接字符串
|
||||||
|
/// </summary>
|
||||||
|
public readonly static string Connection = "PORT=5410;DATABASE=sqlsugar_test;HOST=116.63.182.54;PASSWORD=Test@123456abc;USER ID=test;No Reset On Close=true";
|
||||||
|
|
||||||
|
/// <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.Vastbase,
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user