- 增加 IEnumerable<TEntity> 扩展方法 AsSelect

This commit is contained in:
28810
2019-03-15 15:03:08 +08:00
parent fccc3fc8b9
commit 23d5d33bdd
8 changed files with 139 additions and 8 deletions

View File

@ -27,15 +27,22 @@ namespace FreeSql.Tests {
public virtual Order Order { get; set; }
}
class NullAggreTestTable {
[Column(IsIdentity = true)]
public int Id { get; set; }
}
ISelect<TestInfo> select => g.mysql.Select<TestInfo>();
[Fact]
public void Test1() {
var collSelect1 = g.mysql.Select<Order>().Where(a =>
a.OrderDetails.AsSelect().Where(b => b.OrderId == a.OrderID).Any()
);
var collectionSelect = select.Where(a =>
a.Type.Guid == a.TypeGuid &&
a.Type.Parent.Id == a.Type.ParentId &&
a.Type.Parent.Types.AsSelect().Where(b => b.Name == a.Title).Any(b => b.ParentId == a.Type.Parent.Id)
);
var order = g.mysql.Select<Order>().Where(a => a.OrderID == 1).ToOne(); //<2F><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
var orderDetail1 = order.OrderDetails; //<2F><>һ<EFBFBD>η<EFBFBD><CEB7>ʣ<EFBFBD><CAA3><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD>ݿ<EFBFBD>
var orderDetail2 = order.OrderDetails; //<2F>ڶ<EFBFBD><DAB6>η<EFBFBD><CEB7>ʣ<EFBFBD><CAA3><EFBFBD><EFBFBD><EFBFBD>
@ -182,6 +189,11 @@ namespace FreeSql.Tests {
}
}
class NullAggreTestTable {
[Column(IsIdentity = true)]
public int Id { get; set; }
}
[Table(Name = "xxx", SelectFilter = " a.id > 0")]
class TestInfo {