Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
LinqDataView.cs
Go to the documentation of this file.
5
6namespace System.Data;
7
9{
11
13
14 public override string RowFilter
15 {
16 get
17 {
18 if (base.RowPredicate == null)
19 {
20 return base.RowFilter;
21 }
22 return null;
23 }
24 [RequiresUnreferencedCode("Members of types used in the filter expression might be trimmed.")]
25 set
26 {
27 if (value == null)
28 {
29 base.RowPredicate = null;
30 base.RowFilter = string.Empty;
31 }
32 else
33 {
34 base.RowFilter = value;
35 base.RowPredicate = null;
36 }
37 }
38 }
39
40 PropertyDescriptor IBindingList.SortProperty
41 {
42 get
43 {
44 if (base.SortComparison != null)
45 {
46 return null;
47 }
48 return GetSortProperty();
49 }
50 }
51
52 ListSortDescriptionCollection IBindingListView.SortDescriptions
53 {
54 get
55 {
56 if (base.SortComparison == null)
57 {
58 return GetSortDescriptions();
59 }
61 }
62 }
63
64 bool IBindingList.IsSorted
65 {
66 get
67 {
68 if (base.SortComparison == null)
69 {
70 return base.Sort.Length != 0;
71 }
72 return true;
73 }
74 }
75
77 : base(table)
78 {
79 this.sortExpressionBuilder = sortExpressionBuilder ?? new SortExpressionBuilder<DataRow>();
80 }
81
88
89 internal override int FindByKey(object key)
90 {
91 if (!string.IsNullOrEmpty(base.Sort))
92 {
93 return base.FindByKey(key);
94 }
95 if (base.SortComparison == null)
96 {
98 }
100 {
102 }
103 Index.ComparisonBySelector<object, DataRow> comparison = comparerKeyRow.Invoke;
105 list.Add(key);
106 Range range = FindRecords(comparison, list);
107 if (range.Count != 0)
108 {
109 return range.Min;
110 }
111 return -1;
112 }
113
114 internal override int FindByKey(object[] key)
115 {
116 if (base.SortComparison == null && string.IsNullOrEmpty(base.Sort))
117 {
119 }
120 if (base.SortComparison != null && key.Length != sortExpressionBuilder.Count)
121 {
123 }
124 if (base.SortComparison == null)
125 {
126 return base.FindByKey(key);
127 }
128 Index.ComparisonBySelector<object, DataRow> comparison = comparerKeyRow.Invoke;
130 foreach (object item in key)
131 {
132 list.Add(item);
133 }
134 Range range = FindRecords(comparison, list);
135 if (range.Count != 0)
136 {
137 return range.Min;
138 }
139 return -1;
140 }
141
142 internal override DataRowView[] FindRowsByKey(object[] key)
143 {
144 if (base.SortComparison == null && string.IsNullOrEmpty(base.Sort))
145 {
147 }
148 if (base.SortComparison != null && key.Length != sortExpressionBuilder.Count)
149 {
151 }
152 if (base.SortComparison == null)
153 {
154 return base.FindRowsByKey(key);
155 }
158 }
159
161 {
162 if ((base.SortComparison != null || base.RowPredicate != null) && newRowStates != DataViewRowState.CurrentRows)
163 {
165 }
167 }
168
170 {
171 base.Sort = string.Empty;
172 base.SortComparison = null;
173 }
174}
static InvalidOperationException InvalidOperation(string message)
static ArgumentException Argument(string message)
PropertyDescriptor GetSortProperty()
Definition DataView.cs:908
ListSortDescriptionCollection GetSortDescriptions()
Definition DataView.cs:1030
DataRowView[] GetDataRowViewFromRange(Range range)
Definition DataView.cs:761
static Exception IndexKeyLength(int length, int keyLength)
override string RowFilter
override DataRowView[] FindRowsByKey(object[] key)
LinqDataView(DataTable table, Predicate< DataRow > predicate_system, Comparison< DataRow > comparison, Func< object, DataRow, int > comparerKeyRow, SortExpressionBuilder< DataRow > sortExpressionBuilder)
LinqDataView(DataTable table, SortExpressionBuilder< DataRow > sortExpressionBuilder)
Func< object, DataRow, int > comparerKeyRow
readonly SortExpressionBuilder< DataRow > sortExpressionBuilder
override void SetIndex(string newSort, DataViewRowState newRowStates, IFilter newRowFilter)
override int FindByKey(object key)
override int FindByKey(object[] key)
static string LDVRowStateError
Definition SR.cs:922
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string LDV_InvalidNumOfKeys
Definition SR.cs:920
Definition SR.cs:7