-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
28 lines (26 loc) · 998 Bytes
/
Program.cs
File metadata and controls
28 lines (26 loc) · 998 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
using AutoQuery;
using AutoQuery.Extensions;
using QueryHelperDemo;
using System.Reflection;
var queryProcessor = new QueryProcessor();
queryProcessor.ApplyConfigurationsFromAssembly(Assembly.GetExecutingAssembly());
var users = new List<User>
{
new User(4, "Bob Brown", "bob.brown@example.com", new DateTime(1988, 12, 30)),
new User(1, "John Doe", "john.doe@example.com", new DateTime(1990, 1, 1)),
new User(3, "Alice Johnson", "alice.johnson@example.com", new DateTime(1992, 8, 23)),
new User(5, "Charlie Davis", "charlie.davis@example.com", new DateTime(1995, 3, 10)),
new User(2, "Jane Smith", "jane.smith@example.com", new DateTime(1985, 5, 15)),
};
var result = users.AsQueryable().ApplyQuery(queryProcessor, new UserQueryOptions()
{
Fields = "Id,Name",
Sort = "-Id",
FilterIds = [3, 4],
FilterName = "Alice Johnson"
}).ToArray();
Console.WriteLine("Filtered Users:");
foreach (var user in result)
{
Console.WriteLine($"{user.Id}: {user.Name}");
}