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
32 lines (29 loc) · 963 Bytes
/
Template_Simple.cs
File metadata and controls
32 lines (29 loc) · 963 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
31
32
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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()
{
List<Customer> 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();
}
}
}