mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-24 07:22:57 +08:00
Update demo
This commit is contained in:
parent
adbef253c1
commit
eb3d6aefe9
@ -138,6 +138,29 @@ static void ServerTest()
|
|||||||
var list2111 = sqlugar.Queryable<UnitDatezaaaa>()
|
var list2111 = sqlugar.Queryable<UnitDatezaaaa>()
|
||||||
.Where(it => dates.Contains(it.dateOnly.Value))
|
.Where(it => dates.Contains(it.dateOnly.Value))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
sqlugar.CodeFirst.InitTables<FInfo, ViewWorker>();
|
||||||
|
sqlugar.Insertable(new FInfo()
|
||||||
|
{
|
||||||
|
CustName="a",
|
||||||
|
CustNum="1",
|
||||||
|
Id=1
|
||||||
|
|
||||||
|
}).ExecuteCommand();
|
||||||
|
|
||||||
|
sqlugar.Insertable(new ViewWorker()
|
||||||
|
{
|
||||||
|
StartTime=DateOnly.FromDateTime(DateTime.Now)
|
||||||
|
}).ExecuteCommand();
|
||||||
|
//用例代码
|
||||||
|
var detail = sqlugar.Queryable<FInfo>()
|
||||||
|
.LeftJoin<ViewWorker>((left, right) =>true)
|
||||||
|
.Select((left, right) => new {
|
||||||
|
left.Id,
|
||||||
|
left.CustName,
|
||||||
|
left.CustNum,
|
||||||
|
ViewWorker = right
|
||||||
|
}).First();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -184,7 +207,39 @@ static void OracleTest()
|
|||||||
.Select<(int id, string name)>().ToList();
|
.Select<(int id, string name)>().ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//用例实体
|
||||||
|
public class FInfo
|
||||||
|
{
|
||||||
|
[SugarColumn(ColumnName = "ID", ColumnDataType = "int", IsPrimaryKey = true, IsIdentity = true)]
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
[SugarColumn(ColumnName = "CustName", ColumnDataType = "nvarchar", IsNullable = true)]
|
||||||
|
public string? CustName { get; set; }
|
||||||
|
|
||||||
|
[SugarColumn(ColumnName = "CustNum", ColumnDataType = "nvarchar", IsNullable = true)]
|
||||||
|
public string? CustNum { get; set; }
|
||||||
|
}
|
||||||
|
//用例实体
|
||||||
|
public class ViewWorker
|
||||||
|
{
|
||||||
|
[SugarColumn(ColumnName = "id", ColumnDataType = "int")] // 可根据需要设置主键、自增等属性
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
[SugarColumn(ColumnName = "name", ColumnDataType = "nvarchar", IsNullable = true)]
|
||||||
|
public string? Name { get; set; }
|
||||||
|
|
||||||
|
[SugarColumn(ColumnName = "type", ColumnDataType = "nvarchar", IsNullable = true)]
|
||||||
|
public string? Type { get; set; }
|
||||||
|
|
||||||
|
[SugarColumn(ColumnName = "start_time", ColumnDataType = "date", IsNullable = true)]
|
||||||
|
public DateOnly? StartTime { get; set; }
|
||||||
|
|
||||||
|
[SugarColumn(ColumnName = "end_time", ColumnDataType = "date", IsNullable = true)]
|
||||||
|
public DateOnly? EndTime { get; set; }
|
||||||
|
|
||||||
|
[SugarColumn(ColumnName = "price", ColumnDataType = "real", IsNullable = true)]
|
||||||
|
public float? Price { get; set; }
|
||||||
|
}
|
||||||
public class Unitadfafa
|
public class Unitadfafa
|
||||||
{
|
{
|
||||||
[SugarColumn(SqlParameterDbType =typeof(CommonPropertyConvert))]
|
[SugarColumn(SqlParameterDbType =typeof(CommonPropertyConvert))]
|
||||||
|
Loading…
Reference in New Issue
Block a user