mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 13:06:50 +08:00
Add demo
This commit is contained in:
parent
30febe8bf1
commit
41895680b0
@ -33,6 +33,7 @@ namespace OrmTest
|
|||||||
}
|
}
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
|
Unitysadfay2.Init();
|
||||||
Unitdfaatsd2.Init();
|
Unitdfaatsd2.Init();
|
||||||
Unityadfasasdfa.Init();
|
Unityadfasasdfa.Init();
|
||||||
Unitsdfaafa.Init();
|
Unitsdfaafa.Init();
|
||||||
|
@ -0,0 +1,51 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace OrmTest
|
||||||
|
{
|
||||||
|
internal class Unitysadfay2
|
||||||
|
{
|
||||||
|
public static void Init()
|
||||||
|
{
|
||||||
|
var db = NewUnitTest.Db;
|
||||||
|
db.CodeFirst.InitTables<ClassA, ClassB>();
|
||||||
|
db.Updateable<ClassA>()
|
||||||
|
.InnerJoin<ClassB>((m, e) => m.EmpId == e.EmpId)
|
||||||
|
.Where((m,e)=>true)
|
||||||
|
.SetColumns((m, e) => new ClassA()
|
||||||
|
{
|
||||||
|
EndDate = SqlFunc.IIF(e.CourseModel.Equals("DATE"),
|
||||||
|
SqlFunc.ToDate(e.Deadline).Date,
|
||||||
|
SqlFunc.DateAdd(m.StartDate
|
||||||
|
, e.Period ?? 0
|
||||||
|
, DateType.Day).Date)
|
||||||
|
|
||||||
|
})
|
||||||
|
.ExecuteCommand();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[SugarTable("UnitClasssdfy")]
|
||||||
|
public class ClassA
|
||||||
|
{
|
||||||
|
public string EmpId { get; set; }
|
||||||
|
public DateTime EndDate { get; set; }
|
||||||
|
public DateTime StartDate { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[SugarTable("UnitClassBdfas2")]
|
||||||
|
public class ClassB
|
||||||
|
{
|
||||||
|
public string EmpId { get; set; }
|
||||||
|
public string CourseModel { get; set; }
|
||||||
|
public DateTime? Deadline { get; set; }
|
||||||
|
public int? Period { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user