@@ -17,338 +17,271 @@ namespace DataTables.GeneratorCore
1717 /// <summary>
1818 /// Class to produce the template output
1919 /// </summary>
20-
21- #line 1 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
2220 [ global ::System . CodeDom . Compiler . GeneratedCodeAttribute ( "Microsoft.VisualStudio.TextTemplating" , "16.0.0.0" ) ]
2321 public partial class DataMatrixTemplate : DataMatrixTemplateBase
2422 {
25- #line hidden
2623 /// <summary>
2724 /// Create the template output
2825 /// </summary>
2926 public virtual string TransformText ( )
3027 {
3128 this . Write ( "// <auto-generated />\r \n #pragma warning disable CS0105\r \n #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable.\r \n #pragma warning disable CS8602 // Dereference of a possibly null reference.\r \n using System;\r \n using System.IO;\r \n using System.Collections.Generic;\r \n using System.Runtime.CompilerServices;\r \n using DataTables;\r \n \r \n #nullable enable\r \n \r \n " ) ;
32-
33- #line 18 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
3429 if ( ! string . IsNullOrEmpty ( GenerationContext . Namespace ) ) {
35-
36- #line default
37- #line hidden
3830 this . Write ( "namespace " ) ;
3931
40- #line 19 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
4132 this . Write ( this . ToStringHelper . ToStringWithCulture ( GenerationContext . Namespace ) ) ;
4233
4334 #line default
4435 #line hidden
4536 this . Write ( "\r \n {\r \n " ) ;
46-
47- #line 21 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
4837 }
49-
50- #line default
51- #line hidden
5238 this . Write ( "\r \n public sealed partial class DT" ) ;
5339
54- #line 23 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
5540 this . Write ( this . ToStringHelper . ToStringWithCulture ( GenerationContext . ClassName ) ) ;
5641
5742 #line default
5843 #line hidden
5944 this . Write ( " : DataMatrixBase<" ) ;
6045
61- #line 23 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
6246 this . Write ( this . ToStringHelper . ToStringWithCulture ( BuildTypeString ( kKey1 ) ) ) ;
6347
6448 #line default
6549 #line hidden
6650 this . Write ( ", " ) ;
6751
68- #line 23 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
6952 this . Write ( this . ToStringHelper . ToStringWithCulture ( BuildTypeString ( kKey2 ) ) ) ;
7053
7154 #line default
7255 #line hidden
7356 this . Write ( ", " ) ;
7457
75- #line 23 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
7658 this . Write ( this . ToStringHelper . ToStringWithCulture ( BuildTypeString ( kValue ) ) ) ;
7759
7860 #line default
7961 #line hidden
8062 this . Write ( ">\r \n {\r \n " ) ;
8163
82- #line 25 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
8364 this . Write ( this . ToStringHelper . ToStringWithCulture ( string . IsNullOrEmpty ( GenerationContext . MatrixDefaultValue ) ? string . Empty : "protected override " + BuildTypeString ( kValue ) + " DefaultValue => " + BuildTypeValueString ( kValue , GenerationContext . MatrixDefaultValue ) + ";" + Environment . NewLine ) ) ;
8465
8566 #line default
8667 #line hidden
8768 this . Write ( "\r \n public DT" ) ;
8869
89- #line 26 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
9070 this . Write ( this . ToStringHelper . ToStringWithCulture ( GenerationContext . ClassName ) ) ;
9171
9272 #line default
9373 #line hidden
9474 this . Write ( "(string name, int capacity) : base(name, capacity)\r \n { }\r \n \r \n public override bool ParseDataRow(int index, BinaryReader reader)\r \n {\r \n " ) ;
9575
96- #line 31 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
9776 this . Write ( this . ToStringHelper . ToStringWithCulture ( BuildTypeString ( kKey1 ) ) ) ;
9877
9978 #line default
10079 #line hidden
10180 this . Write ( " " ) ;
10281
103- #line 31 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
10482 this . Write ( this . ToStringHelper . ToStringWithCulture ( kKey1 ) ) ;
10583
10684 #line default
10785 #line hidden
10886 this . Write ( ";\r \n " ) ;
10987
110- #line 32 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
11188 this . Write ( this . ToStringHelper . ToStringWithCulture ( BuildDeserializeMethodString ( kKey1 ) ) ) ;
11289
11390 #line default
11491 #line hidden
11592 this . Write ( "\r \n \r \n " ) ;
11693
117- #line 34 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
11894 this . Write ( this . ToStringHelper . ToStringWithCulture ( BuildTypeString ( kKey2 ) ) ) ;
11995
12096 #line default
12197 #line hidden
12298 this . Write ( " " ) ;
12399
124- #line 34 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
125100 this . Write ( this . ToStringHelper . ToStringWithCulture ( kKey2 ) ) ;
126101
127102 #line default
128103 #line hidden
129104 this . Write ( ";\r \n " ) ;
130105
131- #line 35 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
132106 this . Write ( this . ToStringHelper . ToStringWithCulture ( BuildDeserializeMethodString ( kKey2 ) ) ) ;
133107
134108 #line default
135109 #line hidden
136110 this . Write ( "\r \n \r \n " ) ;
137111
138- #line 37 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
139112 this . Write ( this . ToStringHelper . ToStringWithCulture ( BuildTypeString ( kValue ) ) ) ;
140113
141114 #line default
142115 #line hidden
143116 this . Write ( " " ) ;
144117
145- #line 37 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
146118 this . Write ( this . ToStringHelper . ToStringWithCulture ( kValue ) ) ;
147119
148120 #line default
149121 #line hidden
150122 this . Write ( ";\r \n " ) ;
151123
152- #line 38 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
153124 this . Write ( this . ToStringHelper . ToStringWithCulture ( BuildDeserializeMethodString ( kValue ) ) ) ;
154125
155126 #line default
156127 #line hidden
157128 this . Write ( "\r \n \r \n SetDataRow(index, " ) ;
158129
159- #line 40 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
160130 this . Write ( this . ToStringHelper . ToStringWithCulture ( kKey1 ) ) ;
161131
162132 #line default
163133 #line hidden
164134 this . Write ( ", " ) ;
165135
166- #line 40 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
167136 this . Write ( this . ToStringHelper . ToStringWithCulture ( kKey2 ) ) ;
168137
169138 #line default
170139 #line hidden
171140 this . Write ( ", " ) ;
172141
173- #line 40 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
174142 this . Write ( this . ToStringHelper . ToStringWithCulture ( kValue ) ) ;
175143
176144 #line default
177145 #line hidden
178146 this . Write ( ");\r \n return true;\r \n }\r \n \r \n #region Instance API\r \n \r \n /// <summary>\r \n /// 根据Key1和Key2获取数据值 (实例方法)\r \n /// </summary>\r \n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r \n public " ) ;
179147
180- #line 50 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
181148 this . Write ( this . ToStringHelper . ToStringWithCulture ( BuildTypeString ( kValue ) ) ) ;
182149
183150 #line default
184151 #line hidden
185152 this . Write ( "? GetDataRow(" ) ;
186153
187- #line 50 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
188154 this . Write ( this . ToStringHelper . ToStringWithCulture ( BuildTypeString ( kKey1 ) ) ) ;
189155
190156 #line default
191157 #line hidden
192158 this . Write ( " key1, " ) ;
193159
194- #line 50 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
195160 this . Write ( this . ToStringHelper . ToStringWithCulture ( BuildTypeString ( kKey2 ) ) ) ;
196161
197162 #line default
198163 #line hidden
199164 this . Write ( " key2)\r \n {\r \n return Get(key1, key2);\r \n }\r \n \r \n /// <summary>\r \n /// 根据Key1和Key2获取数据值,如果不存在则返回默认值 (实例方法)\r \n /// </summary>\r \n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r \n public " ) ;
200165
201- #line 59 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
202166 this . Write ( this . ToStringHelper . ToStringWithCulture ( BuildTypeString ( kValue ) ) ) ;
203167
204168 #line default
205169 #line hidden
206170 this . Write ( " GetDataRowOrDefault(" ) ;
207171
208- #line 59 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
209172 this . Write ( this . ToStringHelper . ToStringWithCulture ( BuildTypeString ( kKey1 ) ) ) ;
210173
211174 #line default
212175 #line hidden
213176 this . Write ( " key1, " ) ;
214177
215- #line 59 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
216178 this . Write ( this . ToStringHelper . ToStringWithCulture ( BuildTypeString ( kKey2 ) ) ) ;
217179
218180 #line default
219181 #line hidden
220182 this . Write ( " key2)\r \n {\r \n var result = Get(key1, key2);\r \n return result != null ? result : DefaultValue;\r \n }\r \n \r \n #endregion\r \n \r \n #region Static API\r \n \r \n /// <summary>\r \n /// 获取数据矩阵实例 - 便于访问基类方法 (静态方法)\r \n /// </summary>\r \n public static DT" ) ;
221183
222- #line 72 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
223184 this . Write ( this . ToStringHelper . ToStringWithCulture ( GenerationContext . ClassName ) ) ;
224185
225186 #line default
226187 #line hidden
227188 this . Write ( " Table\r \n {\r \n get\r \n {\r \n var table = DataTableManager.GetDataTableInternal<DT" ) ;
228189
229- #line 76 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
230190 this . Write ( this . ToStringHelper . ToStringWithCulture ( GenerationContext . ClassName ) ) ;
231191
232192 #line default
233193 #line hidden
234194 this . Write ( ">();\r \n if (table == null)\r \n {\r \n throw new InvalidOperationException(\" DT" ) ;
235195
236- #line 79 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
237196 this . Write ( this . ToStringHelper . ToStringWithCulture ( GenerationContext . ClassName ) ) ;
238197
239198 #line default
240199 #line hidden
241200 this . Write ( " not loaded. Call DataTableManager.CreateDataTable<DT" ) ;
242201
243- #line 79 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
244202 this . Write ( this . ToStringHelper . ToStringWithCulture ( GenerationContext . ClassName ) ) ;
245203
246204 #line default
247205 #line hidden
248206 this . Write ( ">() first.\" );\r \n }\r \n return table;\r \n }\r \n }\r \n \r \n /// <summary>\r \n /// 安全获取数据矩阵实例 - 返回null如果未加载 (静态方法)\r \n /// </summary>\r \n public static DT" ) ;
249207
250- #line 88 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
251208 this . Write ( this . ToStringHelper . ToStringWithCulture ( GenerationContext . ClassName ) ) ;
252209
253210 #line default
254211 #line hidden
255212 this . Write ( "? TableOrNull => DataTableManager.GetDataTableInternal<DT" ) ;
256213
257- #line 88 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
258214 this . Write ( this . ToStringHelper . ToStringWithCulture ( GenerationContext . ClassName ) ) ;
259215
260216 #line default
261217 #line hidden
262- this . Write ( ">();\r \n \r \n /// <summary>\r \n /// 检查数据矩阵是否已加载 (静态方法)\r \n /// </summary>\r \n public static bool IsLoaded => DataTableManager.HasDataTable <DT" ) ;
218+ this . Write ( ">();\r \n \r \n /// <summary>\r \n /// 检查数据矩阵是否已加载 (静态方法)\r \n /// </summary>\r \n public static bool IsLoaded => DataTableManager.IsLoaded <DT" ) ;
263219
264- #line 93 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
265220 this . Write ( this . ToStringHelper . ToStringWithCulture ( GenerationContext . ClassName ) ) ;
266221
267222 #line default
268223 #line hidden
269224 this . Write ( ">();\r \n \r \n /// <summary>\r \n /// 根据Key1和Key2获取数据值 (静态方法)\r \n /// </summary>\r \n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r \n public static " ) ;
270225
271- #line 99 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
272226 this . Write ( this . ToStringHelper . ToStringWithCulture ( BuildTypeString ( kValue ) ) ) ;
273227
274228 #line default
275229 #line hidden
276230 this . Write ( "? GetRow(" ) ;
277231
278- #line 99 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
279232 this . Write ( this . ToStringHelper . ToStringWithCulture ( BuildTypeString ( kKey1 ) ) ) ;
280233
281234 #line default
282235 #line hidden
283236 this . Write ( " key1, " ) ;
284237
285- #line 99 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
286238 this . Write ( this . ToStringHelper . ToStringWithCulture ( BuildTypeString ( kKey2 ) ) ) ;
287239
288240 #line default
289241 #line hidden
290242 this . Write ( " key2)\r \n {\r \n var table = DataTableManager.GetDataTableInternal<DT" ) ;
291243
292- #line 101 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
293244 this . Write ( this . ToStringHelper . ToStringWithCulture ( GenerationContext . ClassName ) ) ;
294245
295246 #line default
296247 #line hidden
297248 this . Write ( ">();\r \n return table?.Get(key1, key2);\r \n }\r \n \r \n /// <summary>\r \n /// 根据Key1和Key2获取数据值,如果不存在则返回默认值 (静态方法)\r \n /// </summary>\r \n [MethodImpl(MethodImplOptions.AggressiveInlining)]\r \n public static " ) ;
298249
299- #line 109 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
300250 this . Write ( this . ToStringHelper . ToStringWithCulture ( BuildTypeString ( kValue ) ) ) ;
301251
302252 #line default
303253 #line hidden
304254 this . Write ( " GetRowOrDefault(" ) ;
305255
306- #line 109 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
307256 this . Write ( this . ToStringHelper . ToStringWithCulture ( BuildTypeString ( kKey1 ) ) ) ;
308257
309258 #line default
310259 #line hidden
311260 this . Write ( " key1, " ) ;
312261
313- #line 109 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
314262 this . Write ( this . ToStringHelper . ToStringWithCulture ( BuildTypeString ( kKey2 ) ) ) ;
315263
316264 #line default
317265 #line hidden
318266 this . Write ( " key2)\r \n {\r \n var table = DataTableManager.GetDataTableInternal<DT" ) ;
319267
320- #line 111 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
321268 this . Write ( this . ToStringHelper . ToStringWithCulture ( GenerationContext . ClassName ) ) ;
322269
323270 #line default
324271 #line hidden
325272 this . Write ( ">();\r \n if (table != null)\r \n {\r \n var result = table.Get(key1, key2);\r \n return result != null ? result : table.DefaultValue;\r \n }\r \n return default(" ) ;
326273
327- #line 117 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
328274 this . Write ( this . ToStringHelper . ToStringWithCulture ( BuildTypeString ( kValue ) ) ) ;
329275
330276 #line default
331277 #line hidden
332278 this . Write ( ");\r \n }\r \n \r \n #endregion\r \n }\r \n \r \n " ) ;
333-
334- #line 123 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
335279 if ( ! string . IsNullOrEmpty ( GenerationContext . Namespace ) ) {
336-
337- #line default
338- #line hidden
339280 this . Write ( "}\r \n " ) ;
340-
341- #line 125 "D:\Projects\ChronosGames\DataTables\src\DataTables.GeneratorCore\DataMatrixTemplate.tt"
342281 }
343-
344- #line default
345- #line hidden
346282 return this . GenerationEnvironment . ToString ( ) ;
347283 }
348284 }
349-
350- #line default
351- #line hidden
352285 #region Base class
353286 /// <summary>
354287 /// Base class for this transformation
0 commit comments