本文整理汇总了C#中EntityQuery.Select方法的典型用法代码示例。如果您正苦于以下问题:C# EntityQuery.Select方法的具体用法?C# EntityQuery.Select怎么用?C# EntityQuery.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EntityQuery
的用法示例。
在下文中一共展示了EntityQuery.Select方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AnonSelectEntityCollection
public async Task AnonSelectEntityCollection() {
var em1 = await TestFns.NewEm(_serviceName);
// precache the selected custs - needed to insure that local query works later.
var q0 = new EntityQuery<Foo.Customer>("Customers")
.Where(c => c.CompanyName.StartsWith("C"));
var r0 = await q0.With(em1).Execute();
var q2 = q0.Select(c => new { Orders = c.Orders });
var r2 = await q2.Execute(em1);
Assert.IsTrue(r2.Count() > 0);
var ok = r2.All(r1 => (r1.Orders.Count() > 0) && r1.Orders.All(o => o.GetType() == typeof(Foo.Order)));
Assert.IsTrue(ok, "every item of anon should contain a collection of Orders");
var r3Local = q2.ExecuteLocally(em1);
Assert.IsTrue(r3Local.Count() == r2.Count());
ok = r3Local.All(r1 => (r1.Orders.Count() > 0) && r1.Orders.All(o => o.GetType() == typeof(Foo.Order)));
Assert.IsTrue(ok, "every item of anon should contain a collection of Orders again");
}