mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-06-28 13:34:32 +08:00
Add .NET7 Test
This commit is contained in:
parent
6afc6180e2
commit
10df47cdef
31
Src/Asp.NetCore2/Net7Test/NET7Test/NET7Test.sln
Normal file
31
Src/Asp.NetCore2/Net7Test/NET7Test/NET7Test.sln
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.4.33103.184
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET7Test", "NET7Test\NET7Test.csproj", "{15BFBF64-4F94-4A42-8ECF-669C5B1C8F73}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SqlSugar", "..\..\SqlSugar\SqlSugar.csproj", "{76C78B01-FB96-4399-AE20-AFE76632521D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{15BFBF64-4F94-4A42-8ECF-669C5B1C8F73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{15BFBF64-4F94-4A42-8ECF-669C5B1C8F73}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{15BFBF64-4F94-4A42-8ECF-669C5B1C8F73}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{15BFBF64-4F94-4A42-8ECF-669C5B1C8F73}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{76C78B01-FB96-4399-AE20-AFE76632521D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{76C78B01-FB96-4399-AE20-AFE76632521D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{76C78B01-FB96-4399-AE20-AFE76632521D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{76C78B01-FB96-4399-AE20-AFE76632521D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {26877270-2C8D-4E33-B38B-B62D481CFFA4}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
14
Src/Asp.NetCore2/Net7Test/NET7Test/NET7Test/NET7Test.csproj
Normal file
14
Src/Asp.NetCore2/Net7Test/NET7Test/NET7Test/NET7Test.csproj
Normal file
@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\SqlSugar\SqlSugar.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
65
Src/Asp.NetCore2/Net7Test/NET7Test/NET7Test/Program.cs
Normal file
65
Src/Asp.NetCore2/Net7Test/NET7Test/NET7Test/Program.cs
Normal file
@ -0,0 +1,65 @@
|
||||
using SqlSugar;
|
||||
|
||||
ServerTest();
|
||||
|
||||
Console.Read();
|
||||
static void MyTest()
|
||||
{
|
||||
var sqlugar = new SqlSugarClient(new ConnectionConfig()
|
||||
{
|
||||
DbType = DbType.SqlServer,
|
||||
ConnectionString = "SERVER=.;uid=sa;pwd=sasa;database=SqlSugar4Text4"
|
||||
},
|
||||
it =>
|
||||
{
|
||||
it.Aop.OnLogExecuting = (s, p) => Console.WriteLine(s, p);
|
||||
});
|
||||
sqlugar.DbMaintenance.CreateDatabase();
|
||||
sqlugar.CodeFirst.InitTables<UnitDate01231>();
|
||||
sqlugar.Insertable(new UnitDate01231()
|
||||
{
|
||||
dateOnly = DateOnly.FromDateTime(DateTime.Now),
|
||||
timeOnly = TimeOnly.FromDateTime(DateTime.Now),
|
||||
}).ExecuteCommand();
|
||||
|
||||
|
||||
|
||||
var list = sqlugar.Queryable<UnitDate01231>().OrderByDescending(it => it.dateOnly).ToList();
|
||||
|
||||
var d1 = new UnitDate01231().dateOnly;
|
||||
var d2 = new UnitDate01231().timeOnly;
|
||||
}
|
||||
static void ServerTest()
|
||||
{
|
||||
var sqlugar = new SqlSugarClient(new ConnectionConfig()
|
||||
{
|
||||
DbType = DbType.SqlServer,
|
||||
ConnectionString = "SERVER=.;uid=sa;pwd=sasa;database=SqlSugar4Text4"
|
||||
},
|
||||
it =>
|
||||
{
|
||||
it.Aop.OnLogExecuting = (s, p) => Console.WriteLine(s, p);
|
||||
});
|
||||
sqlugar.DbMaintenance.CreateDatabase();
|
||||
sqlugar.CodeFirst.InitTables<UnitDate01231>();
|
||||
sqlugar.Insertable(new UnitDate01231()
|
||||
{
|
||||
dateOnly = DateOnly.FromDateTime(DateTime.Now),
|
||||
timeOnly = TimeOnly.FromDateTime(DateTime.Now),
|
||||
}).ExecuteCommand();
|
||||
|
||||
|
||||
|
||||
var list = sqlugar.Queryable<UnitDate01231>().OrderByDescending(it => it.dateOnly).ToList();
|
||||
|
||||
var d1 = new UnitDate01231().dateOnly;
|
||||
var d2 = new UnitDate01231().timeOnly;
|
||||
}
|
||||
|
||||
public class UnitDate01231
|
||||
{
|
||||
[SugarColumn(ColumnDataType = "time")]
|
||||
public TimeOnly timeOnly { get; set; }
|
||||
[SugarColumn(ColumnDataType = "datetime")]
|
||||
public DateOnly dateOnly { get; set; }
|
||||
}
|
Loading…
Reference in New Issue
Block a user