forked from zzzprojects/System.Linq.Dynamic.Core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTemplate_Simple.cs
More file actions
30 lines (27 loc) · 923 Bytes
/
Template_Simple.cs
File metadata and controls
30 lines (27 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
namespace Z.Dynamic.Core.Lab
{
public class Template_Simple
{
public class Customer
{
public string City { get; set; }
public List<Order> Orders { get; set; }
public string CompanyName { get; set; }
public string Phone { get; set; }
}
public class Order
{
}
public static void Execute()
{
var customers = new List<Customer>() { new Customer() { City = "ZZZ", CompanyName = "ZZZ", Orders = new List<Order>() { new Order() }, Phone = "555 5555" } };
var query = customers.AsQueryable()
.Where("City == @0 and Orders.Count >= @1", "ZZZ", 1)
.OrderBy("CompanyName")
.Select("new(CompanyName as Name, Phone)").ToDynamicList();
}
}
}