本文整理汇总了C#中EntityQuery.ExecuteLocally方法的典型用法代码示例。如果您正苦于以下问题:C# EntityQuery.ExecuteLocally方法的具体用法?C# EntityQuery.ExecuteLocally怎么用?C# EntityQuery.ExecuteLocally使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EntityQuery
的用法示例。
在下文中一共展示了EntityQuery.ExecuteLocally方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WithOnlyExpand
public async Task WithOnlyExpand() {
var em1 = await TestFns.NewEm(_serviceName);
var q = new EntityQuery<Customer>().Take(3);
var r0 = await em1.ExecuteQuery(q);
var q1 = new EntityQuery<Customer>().Expand("Orders");
var r1 = q1.ExecuteLocally(em1);
Assert.IsTrue(r0.Count() == r1.Count());
}
示例2: WithOnlyExpand
public async Task WithOnlyExpand() {
await _emTask;
var q = new EntityQuery<Customer>().Take(3);
var r0 = await _em1.ExecuteQuery(q);
var q1 = new EntityQuery<Customer>().Expand("Orders");
var r1 = q1.ExecuteLocally(_em1);
Assert.IsTrue(r0.Count() == r1.Count());
}
示例3: SimpleQuery
public async Task SimpleQuery() {
var em1 = await TestFns.NewEm(_serviceName);
var q = new EntityQuery<Customer>();
var r0 = await em1.ExecuteQuery(q);
Assert.IsTrue(r0.Cast<Object>().Count() > 0);
var r1 = q.ExecuteLocally(em1);
Assert.IsTrue(r0.Count() == r1.Count());
}
示例4: SimpleQuery
public async Task SimpleQuery() {
await _emTask;
var q = new EntityQuery<Customer>();
var r0 = await _em1.ExecuteQuery(q);
Assert.IsTrue(r0.Cast<Object>().Count() > 0);
var r1 = q.ExecuteLocally(_em1);
Assert.IsTrue(r0.Count() == r1.Count());
}
示例5: GuidQuery2
public async Task GuidQuery2() {
var em1 = await TestFns.NewEm(_serviceName);
var q = new EntityQuery<Customer>().Take(3);
var r = await em1.ExecuteQuery(q);
Assert.IsTrue(r.Count() == 3, "should be no results");
var q1 = new EntityQuery<Order>().Where(o => o.CustomerID == Guid.NewGuid()); // && true);
var r1 = q1.ExecuteLocally(em1);
Assert.IsTrue(r1.Count() == 0);
}
示例6: AnonSelectEntity
public async Task AnonSelectEntity() {
var em1 = await TestFns.NewEm(_serviceName);
var q = new EntityQuery<Order>().Take(5);
var r0 = await q.Execute(em1);
Assert.IsTrue(r0.Count() == 5);
var q1 = new EntityQuery<Order>().Select(o => new { o.Customer }).Take(5);
var r1 = await q1.Execute(em1);
Assert.IsTrue(r1.Count() == 5);
var ok = r1.All(r => r.Customer.GetType() == typeof(Customer));
Assert.IsTrue(ok);
// This only works because we insure that the order exists in cache before the query
var r1Local = q1.ExecuteLocally(em1);
Assert.IsTrue(r1Local.Count() == r1.Count());
ok = r1Local.All(r => r.Customer.Orders.Count == 1);
Assert.IsTrue(ok, "Order's per customer should be only one for now because that's all we cached");
ok = r1Local.All(r => r.Customer.GetType() == typeof(Customer));
Assert.IsTrue(ok );
}
示例7: GuidQuery
public async Task GuidQuery() {
await _emTask;
var q = new EntityQuery<Customer>().Take(3);
var r = await _em1.ExecuteQuery(q);
Assert.IsTrue(r.Count() == 3, "should be no results");
var q1 = new EntityQuery<Customer>().Where(c => c.CustomerID.Equals(Guid.NewGuid()));
var r1 = q1.ExecuteLocally(_em1);
Assert.IsTrue(r1.Count() == 0);
}
示例8: WhereFnAdd
public async Task WhereFnAdd() {
var em1 = await TestFns.NewEm(_serviceName);
var q0 = new EntityQuery<Employee>().Where(e => e.EmployeeID + e.ReportsToEmployeeID.Value > 3);
var r0 = await q0.Execute(em1);
Assert.IsTrue(r0.Count() > 0);
Assert.IsTrue(r0.All(e => e.EmployeeID + e.ReportsToEmployeeID > 3));
var r1 = q0.ExecuteLocally(em1);
Assert.IsTrue(r1.Count() == r0.Count());
}
示例9: WhereFnMonth
public async Task WhereFnMonth() {
var em1 = await TestFns.NewEm(_serviceName);
var q0 = new EntityQuery<Employee>().Where(e => e.HireDate.Value.Month > 6 && e.HireDate.Value.Month < 11);
var r0 = await q0.Execute(em1);
Assert.IsTrue(r0.Count() > 0);
Assert.IsTrue(r0.All(e => e.HireDate.Value.Month > 6 && e.HireDate.Value.Month < 11));
var r1 = q0.ExecuteLocally(em1);
Assert.IsTrue(r1.Count() == r0.Count());
}
示例10: SimpleSelect
public async Task SimpleSelect() {
await _emTask;
var q = new EntityQuery<Order>().Take(5);
var r = await q.Execute(_em1);
Assert.IsTrue(r.Count() == 5);
var q1 = new EntityQuery<Order>().Select(o => o.Customer).Take(5);
var r1 = await q1.Execute(_em1);
Assert.IsTrue(r1.Count() == 5);
var ok = r1.All(c => c.GetType() == typeof(Customer));
Assert.IsTrue(ok);
var r1Local = q1.ExecuteLocally(_em1);
Assert.IsTrue(r1Local.Count() == r1.Count());
ok = r1Local.All(c => c.GetType() == typeof(Customer));
Assert.IsTrue(ok );
}
示例11: QueryWithAddFn
public async Task QueryWithAddFn() {
await _emTask;
var q0 = new EntityQuery<Employee>().Where(e => e.EmployeeID + e.ReportsToEmployeeID.Value > 3);
var r0 = await q0.Execute(_em1);
Assert.IsTrue(r0.Count() > 0);
Assert.IsTrue(r0.All(e => e.EmployeeID + e.ReportsToEmployeeID > 3));
var r1 = q0.ExecuteLocally(_em1);
Assert.IsTrue(r1.Count() == r0.Count());
}
示例12: QueryWithMonthFn
public async Task QueryWithMonthFn() {
await _emTask;
var q0 = new EntityQuery<Employee>().Where(e => e.HireDate.Value.Month > 6 && e.HireDate.Value.Month < 11);
var r0 = await q0.Execute(_em1);
Assert.IsTrue(r0.Count() > 0);
Assert.IsTrue(r0.All(e => e.HireDate.Value.Month > 6 && e.HireDate.Value.Month < 11));
var r1 = q0.ExecuteLocally(_em1);
Assert.IsTrue(r1.Count() == r0.Count());
}
示例13: QueryWithYearFn
public async Task QueryWithYearFn() {
await _emTask;
var q0 = new EntityQuery<Employee>().Where(e => e.HireDate.Value.Year > 1993);
var r0 = await q0.Execute(_em1);
Assert.IsTrue(r0.Count() > 0);
Assert.IsTrue(r0.All(r => r.HireDate.Value.Year > 1993));
var r1 = q0.ExecuteLocally(_em1);
Assert.IsTrue(r1.Count() == r0.Count());
}