mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-18 20:08:15 +08:00
- 增加 IEnumerable<TEntity> 扩展方法 AsSelect
This commit is contained in:
@ -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 {
|
||||
|
Reference in New Issue
Block a user