Add user test case

This commit is contained in:
sunkaixuan 2023-11-30 16:50:44 +08:00
parent 85eb94cd59
commit def86bd8a2

View File

@ -55,6 +55,10 @@ namespace OrmTest
DeviceBrandId = a.DeviceBrandId,
BrandName = a.DeviceBrand.Name,
}).ToList();
db.CodeFirst.InitTables<DeviceEntity2, DeviceBrandEntity2>();
var list= db.Queryable<DeviceEntity2, DeviceBrandEntity2>((x, y) =>
new JoinQueryInfos(JoinType.Left,x.Id==y.Id))
.ToList();
}
/// <summary>
@ -92,6 +96,43 @@ namespace OrmTest
public bool IsDelete { get; set; }
}
/// <summary>
/// 仪器
/// </summary>
[SugarTable("Device2")]
public class DeviceEntity2 : IDeletedFilter
{
/// <summary>
/// id
/// </summary>
[SugarColumn(IsPrimaryKey = true)]
public string Id { get; set; }
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 仪器品牌id
/// </summary>
[SugarColumn(IsNullable = true)]
public string DeviceBrandId { get; set; }
/// <summary>
/// 设备品牌
/// </summary>
[Navigate(NavigateType.OneToOne, nameof(DeviceBrandId))]
public DeviceBrandEntity DeviceBrand { get; set; }
/// <summary>
/// 是否删除
/// </summary>
[SugarColumn(ColumnName = "Is_Delete")]
public bool IsDelete { get; set; }
}
internal interface IDeletedFilter
{
/// <summary>
@ -117,5 +158,28 @@ namespace OrmTest
public string Name { get; set; }
}
/// <summary>
/// 仪器品牌
/// </summary>
[SugarTable("DeviceBrand2")]
public class DeviceBrandEntity2:IDeletedFilter
{
/// <summary>
/// id
/// </summary>
[SugarColumn(IsPrimaryKey = true)]
public string Id { get; set; }
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 是否删除
/// </summary>
[SugarColumn(ColumnName = "Is_Delete")]
public bool IsDelete { get; set; }
}
}
}