forked from zzzprojects/System.Linq.Dynamic.Core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKeywords.xml
More file actions
94 lines (74 loc) · 4.05 KB
/
Keywords.xml
File metadata and controls
94 lines (74 loc) · 4.05 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?xml version="1.0" encoding="utf-8" ?>
<DynLINQDoc xmlns="http://schemas.plainlogic.net/dynamiclinqdocs/2014">
<Keywords>
<Keyword name="it">
<Description>`it` is a context keyword that allows a string expression to reference the current data element being referenced.</Description>
<Remarks>You can use the equivalent symbol `$` instead of `it`.
All context keywords (`it`, `parent`, and `root`) can be disabled by setting `GlobalConfig`.[`AreContextKeywordsEnabled`][0] to `false`.
[0]: /Library/GlobalConfig/Property-AreContextKeywordsEnabled</Remarks>
<Examples>
<Example>
<HeaderRemarks>The following example shows how to use the `it` keyword.</HeaderRemarks>
<ExampleCode>var baseQuery = new int[] { 1, 2, 3, 4, 5 }.AsQueryable();
//Using the it keyword in a select statement
var result1 = baseQuery.Select("it * $");
//Using the it keyword in a where statement
var result2 = baseQuery.Where("it % 2 = 0");</ExampleCode>
</Example>
</Examples>
</Keyword>
<Keyword name="parent">
<Description>`parent` is a context keyword that allows a string expression to reference the parent of the current data element being referenced.</Description>
<Remarks>You can use the equivalent symbol `^` instead of `parent`.
All context keywords (`it`, `parent`, and `root`) can be disabled by setting `GlobalConfig`.[`AreContextKeywordsEnabled`][0] to `false`.
[0]: /Library/GlobalConfig/Property-AreContextKeywordsEnabled</Remarks>
</Keyword>
<Keyword name="root">
<Description>`root` is a context keyword that allows a string expression to reference the root data element.</Description>
<Remarks>You can use the equivalent symbol `~` instead of `root`.
All context keywords (`it`, `parent`, and `root`) can be disabled by setting `GlobalConfig`.[`AreContextKeywordsEnabled`][0] to `false`.
[0]: /Library/GlobalConfig/Property-AreContextKeywordsEnabled</Remarks>
</Keyword>
<Keyword name="new">
<Description>`new` allows for the creation of anonymous types.</Description>
<Remarks>Equivalent to the `new { Amount = 108, Message = "Hello" }` construct in c#.</Remarks>
<Examples>
<Example>
<HeaderRemarks>The following example demonstrates how to use `new` in a string expression.</HeaderRemarks>
<ExampleCode>"new(108 as Amount, \"Hello\" as Message)"</ExampleCode>
<EquivalentCode>new { Amount = 108, Message = "Hello" }</EquivalentCode>
</Example>
</Examples>
</Keyword>
<Keyword name="iif">
<Description>`iif` is used to create an inline if statement.</Description>
<Examples>
<Example>
<HeaderRemarks>The following example how to use the `iif` keyword.</HeaderRemarks>
<ExampleCode>var baseQuery = new int[] { 1, 2, 3, 4, 5 }.AsQueryable();
var result = baseQuery.Select("iif(it % 2 = 0, true, false)");</ExampleCode>
<EquivalentCode>var baseQuery = new int[] { 1, 2, 3, 4, 5 }.AsQueryable();
var result = baseQuery.Select(x => x % 2 == 0 ? true : false);</EquivalentCode>
</Example>
</Examples>
</Keyword>
<Keyword name="in">
<Description>`in` is used to determines whether a sequence contains a specified element.</Description>
<Remarks>
Compare to [`Contains`][0] Expression Method.
[0]: /Expressions/Contains
</Remarks>
<Examples>
<Example>
<HeaderRemarks>The following example demonstrates how to use the `in` keyword to determine whether a sequence contains a specific element.</HeaderRemarks>
<ExampleCode>var rangeOfNumbers = Enumerable.Range(1, 100).ToArray();
//Use a fixed set of numbers to test for
var result1 = rangeOfNumbers.AsQueryable().Where("it in (2,4,6,8)").ToArray();
//Use a variable set of numbers to test for
var values = new int[] { 2, 4, 6, 8 };
var result2 = rangeOfNumbers.AsQueryable().Where("it in @0", values).ToArray();</ExampleCode>
</Example>
</Examples>
</Keyword>
</Keywords>
</DynLINQDoc>