|
@ -1,4 +1,5 @@ |
|
|
using System; |
|
|
using SqlSugar; |
|
|
|
|
|
using System; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
using System.Linq; |
|
|
using System.Linq; |
|
|
using System.Text; |
|
|
using System.Text; |
|
@ -14,6 +15,34 @@ namespace OrmTest |
|
|
Db.DbMaintenance.DropTable("UnitCodeTest1"); |
|
|
Db.DbMaintenance.DropTable("UnitCodeTest1"); |
|
|
Db.CodeFirst.InitTables<UnitCodeTest1>(); |
|
|
Db.CodeFirst.InitTables<UnitCodeTest1>(); |
|
|
Db.CodeFirst.InitTables<UnitIndextest>(); |
|
|
Db.CodeFirst.InitTables<UnitIndextest>(); |
|
|
|
|
|
var db = Db; |
|
|
|
|
|
db.CurrentConnectionConfig.MoreSettings = new ConnMoreSettings() |
|
|
|
|
|
{ |
|
|
|
|
|
PgSqlIsAutoToLower = false, |
|
|
|
|
|
PgSqlIsAutoToLowerCodeFirst = false |
|
|
|
|
|
}; |
|
|
|
|
|
db.CodeFirst.InitTables<UpperOrder>(); |
|
|
|
|
|
var list = db.Queryable<UpperOrder>().LeftJoin<UpperOrder>((X1, Y1) => |
|
|
|
|
|
X1.Id == Y1.Id) |
|
|
|
|
|
.Where(X1 => X1.Id == 1) |
|
|
|
|
|
.Select(X1 => new { |
|
|
|
|
|
x1 = X1.Id, |
|
|
|
|
|
x2 = X1.Name |
|
|
|
|
|
}).ToList(); |
|
|
|
|
|
} |
|
|
|
|
|
public class UpperOrder |
|
|
|
|
|
{ |
|
|
|
|
|
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)] |
|
|
|
|
|
public int Id { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
public string Name { get; set; } |
|
|
|
|
|
public decimal Price { get; set; } |
|
|
|
|
|
[SugarColumn(IsNullable = true)] |
|
|
|
|
|
public DateTime CreateTime { get; set; } |
|
|
|
|
|
[SugarColumn(IsNullable = true)] |
|
|
|
|
|
public int CustomId { get; set; } |
|
|
|
|
|
[SugarColumn(IsIgnore = true)] |
|
|
|
|
|
public List<OrderItem> Items { get; set; } |
|
|
} |
|
|
} |
|
|
[SqlSugar.SugarIndex("UnitIndextestIndex", nameof(UnitIndextest.Table), SqlSugar.OrderByType.Asc)] |
|
|
[SqlSugar.SugarIndex("UnitIndextestIndex", nameof(UnitIndextest.Table), SqlSugar.OrderByType.Asc)] |
|
|
public class UnitIndextest |
|
|
public class UnitIndextest |
|
|