mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
Add user test case
This commit is contained in:
parent
da7c853093
commit
5040c63c1d
@ -32,6 +32,7 @@ namespace OrmTest
|
|||||||
}
|
}
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
|
Unitadfafafa.Init();
|
||||||
UnitSubGroupadfa.Init();
|
UnitSubGroupadfa.Init();
|
||||||
UnitAsyncToken.Init();
|
UnitAsyncToken.Init();
|
||||||
UnitSplitadfa.Init();
|
UnitSplitadfa.Init();
|
||||||
|
81
Src/Asp.NetCore2/SqliteTest/UserTestCases/Unitadfafafa.cs
Normal file
81
Src/Asp.NetCore2/SqliteTest/UserTestCases/Unitadfafafa.cs
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using SqliteTest.UnitTest;
|
||||||
|
using SqlSugar;
|
||||||
|
namespace OrmTest
|
||||||
|
{
|
||||||
|
public class Unitadfafafa
|
||||||
|
{
|
||||||
|
public static void Init()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
ISqlSugarClient db = new SqlSugarScope(new SqlSugar.ConnectionConfig()
|
||||||
|
{
|
||||||
|
ConnectionString = Config.ConnectionString,
|
||||||
|
DbType = DbType.Sqlite,
|
||||||
|
IsAutoCloseConnection = true,
|
||||||
|
ConfigureExternalServices = new ConfigureExternalServices
|
||||||
|
{
|
||||||
|
EntityService = (c, p) =>
|
||||||
|
{
|
||||||
|
if (new NullabilityInfoContext()
|
||||||
|
.Create(c).WriteState is NullabilityState.Nullable)
|
||||||
|
{
|
||||||
|
p.IsNullable = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
}, db =>
|
||||||
|
{
|
||||||
|
|
||||||
|
//db.Aop.OnLogExecuting = (sql, pars) => //SQL执行前
|
||||||
|
//{
|
||||||
|
|
||||||
|
// var str = UtilMethods.GetSqlString(DbType.MySql, sql, pars);
|
||||||
|
// Console.WriteLine("===");
|
||||||
|
// Console.WriteLine(str);
|
||||||
|
// Console.WriteLine("===");
|
||||||
|
//};
|
||||||
|
|
||||||
|
});
|
||||||
|
db.CodeFirst.InitTables<Test003>();
|
||||||
|
var res2 = db.Insertable<Test003>(new Test003() { OVOV = new ObjctValueTest { Code333 = "11", Code4444 = "333" } }).ExecuteCommand();
|
||||||
|
var res = db.Queryable<Test003>().Any(x => true);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[SugarTable("Test003")]
|
||||||
|
//建类
|
||||||
|
public class Test003
|
||||||
|
{
|
||||||
|
[SugarColumn(IsPrimaryKey = true)]
|
||||||
|
public Guid Id { get; set; } = Guid.NewGuid();
|
||||||
|
|
||||||
|
public DateTime? CreateTime { get; set; } = DateTime.Now;
|
||||||
|
|
||||||
|
|
||||||
|
public string? Code { get; set; }
|
||||||
|
|
||||||
|
[SqlSugar.SugarColumn(IsOwnsOne = true)]
|
||||||
|
public ObjctValueTest OVOV { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ObjctValueTest
|
||||||
|
{
|
||||||
|
public string Code4444 { get; set; }
|
||||||
|
|
||||||
|
public string Code333 { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user