-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathObjectModelGenerator.cs
More file actions
536 lines (443 loc) · 22.5 KB
/
ObjectModelGenerator.cs
File metadata and controls
536 lines (443 loc) · 22.5 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using Vim.Format.ObjectModel;
namespace Vim.Format.CodeGen;
public static class ObjectModelGenerator
{
public static string GetEntityTableGetterFunctionName(this ValueSerializationStrategy strategy, Type type)
{
return strategy switch
{
ValueSerializationStrategy.SerializeAsStringColumn
=> nameof(EntityTable.GetStringColumnValues),
ValueSerializationStrategy.SerializeAsDataColumn
=> $"{nameof(EntityTable.GetDataColumnValues)}<{type.Name}>",
_ => throw new Exception($"{nameof(GetEntityTableGetterFunctionName)} error - unknown strategy {strategy:G}")
};
}
public static string GetEntityTable_v2GetterFunctionName(this ValueSerializationStrategy strategy, Type type)
{
return strategy switch
{
ValueSerializationStrategy.SerializeAsStringColumn
=> nameof(EntityTable_v2.GetStringColumnValues),
ValueSerializationStrategy.SerializeAsDataColumn
=> $"{nameof(EntityTable_v2.GetDataColumnValues)}<{type.Name}>",
_ => throw new Exception($"{nameof(GetEntityTable_v2GetterFunctionName)} error - unknown strategy {strategy:G}")
};
}
private static string GetEntityTableBuilderAddFunctionName(this ValueSerializationStrategy strategy, Type typeName)
{
return strategy switch
{
ValueSerializationStrategy.SerializeAsStringColumn
=> nameof(EntityTableBuilder.AddStringColumn),
ValueSerializationStrategy.SerializeAsDataColumn
=> $"{nameof(EntityTableBuilder.AddDataColumn)}",
_ => throw new Exception($"{nameof(GetEntityTableBuilderAddFunctionName)} error - unknown strategy {strategy:G}")
};
}
private class EntityFields
{
public readonly List<string> TableInitializers = new();
public readonly List<string> ArraysInitializers = new();
public readonly List<string> RelationalColumns = new();
}
private static CodeBuilder WriteDocumentEntityData(Type t, CodeBuilder cb, EntityFields constructor)
{
cb.AppendLine("");
cb.AppendLine($"// {t.Name}");
cb.AppendLine("");
var relationFields = t.GetRelationFields().ToArray();
var entityFields = t.GetEntityFields().ToArray();
// EntityTables
cb.AppendLine($"public EntityTable {t.Name}EntityTable {{ get; }}");
constructor.TableInitializers.Add($"{t.Name}EntityTable = Document.GetTable(\"{t.GetEntityTableName()}\");");
cb.AppendLine("");
// Get each non-relational columns for each element
foreach (var fieldInfo in entityFields)
{
var fieldName = fieldInfo.Name;
var fieldType = fieldInfo.FieldType;
var fieldTypeName = fieldInfo.FieldType.Name;
var loadingInfos = fieldInfo.GetEntityColumnLoadingInfo();
var baseStrategy = loadingInfos[0].Strategy; // Invariant: there is always at least one entityColumnInfo (the default one)
var dataColumnGetters = loadingInfos.Select(eci =>
{
var functionName = eci.Strategy.GetEntityTableGetterFunctionName(eci.EntityColumnAttribute.SerializedType);
var dataColumnGetter = $"{t.Name}EntityTable?.{functionName}(\"{eci.SerializedValueColumnName}\")";
if (eci.EntityColumnAttribute.SerializedType != fieldType)
{
dataColumnGetter += $"?.Select(v => ({fieldTypeName}) v)";
}
return dataColumnGetter;
}).ToArray();
var dataColumnGetterString = dataColumnGetters.Length > 1
? $"({string.Join(" ?? ", dataColumnGetters)})"
: dataColumnGetters[0];
cb.AppendLine($"public IArray<{fieldTypeName}> {t.Name}{fieldName} {{ get; }}");
constructor.ArraysInitializers
.Add($"{t.Name}{fieldName} = {dataColumnGetterString} ?? Array.Empty<{fieldTypeName}>().ToIArray();");
// Safe accessor.
var defaultValue = baseStrategy == ValueSerializationStrategy.SerializeAsStringColumn ? "\"\"" : "default";
cb.AppendLine($"public {fieldTypeName} Get{t.Name}{fieldName}(int index, {fieldTypeName} defaultValue = {defaultValue}) => {t.Name}{fieldName}?.ElementAtOrDefault(index, defaultValue) ?? defaultValue;");
}
// Get each relational column
foreach (var fieldInfo in relationFields)
{
var (indexColumnName, localFieldName) = fieldInfo.GetIndexColumnInfo();
cb.AppendLine($"public IArray<int> {t.Name}{localFieldName}Index {{ get; }}");
constructor.RelationalColumns
.Add($"{t.Name}{localFieldName}Index = {t.Name}EntityTable?.GetIndexColumnValues(\"{indexColumnName}\") ?? Array.Empty<int>().ToIArray();");
cb.AppendLine($"public int Get{t.Name}{localFieldName}Index(int index) => {t.Name}{localFieldName}Index?.ElementAtOrDefault(index, EntityRelation.None) ?? EntityRelation.None;");
}
// Num Count
cb.AppendLine($"public int Num{t.Name} => {t.Name}EntityTable?.NumRows ?? 0;");
// Entity lists
cb.AppendLine($"public IArray<{t.Name}> {t.Name}List {{ get; }}");
// Element getter function
cb.AppendLine($"public {t.Name} Get{t.Name}(int n)");
cb.AppendLine("{");
// Get the entity retrieval function
cb.AppendLine("if (n < 0) return null;");
cb.AppendLine($"var r = new {t.Name}();");
cb.AppendLine("r.Document = Document;");
cb.AppendLine("r.Index = n;");
foreach (var fieldInfo in entityFields)
{
cb.AppendLine($"r.{fieldInfo.Name} = {t.Name}{fieldInfo.Name}.ElementAtOrDefault(n);");
}
foreach (var fieldInfo in relationFields)
{
var relType = fieldInfo.FieldType.RelationTypeParameter();
cb.AppendLine($"r.{fieldInfo.Name} = new Relation<{relType}>(Get{t.Name}{fieldInfo.Name.Substring(1)}Index(n), Get{relType.Name});");
}
cb.AppendLine("return r;");
cb.AppendLine("}");
cb.AppendLine();
return cb;
}
private static CodeBuilder WriteEntityClass(Type t, CodeBuilder cb = null)
{
var relationFields = t.GetRelationFields().ToArray();
cb ??= new CodeBuilder();
cb.AppendLine("// AUTO-GENERATED");
cb.AppendLine($"public partial class {t.Name}").AppendLine("{");
foreach (var fieldInfo in relationFields)
{
cb.AppendLine($"public {fieldInfo.FieldType.RelationTypeParameter()} {fieldInfo.Name.Substring(1)} => {fieldInfo.Name}.Value;");
}
cb.AppendLine($"public {t.Name}()");
cb.AppendLine("{");
foreach (var fieldInfo in relationFields)
{
cb.AppendLine($"{fieldInfo.Name} = new Relation<{fieldInfo.FieldType.RelationTypeParameter()}>();");
}
cb.AppendLine("}");
cb.AppendLine();
cb.AppendLine("public override bool FieldsAreEqual(object obj)");
cb.AppendLine("{");
cb.WriteFieldsAreEqualsType(t);
cb.AppendLine("return false;");
cb.AppendLine("}");
cb.AppendLine();
cb.AppendLine("} // end of class");
cb.AppendLine();
return cb;
}
private static CodeBuilder WriteFieldsAreEqualsType(this CodeBuilder cb, Type t,
(string @namespace, string variable)? modifier = null)
{
var entityFields = t.GetEntityFields().ToArray();
var relationFields = t.GetRelationFields().ToArray();
var type = (modifier?.@namespace ?? string.Empty) + t.Name;
var variable = (modifier?.variable ?? string.Empty) + "other";
cb.AppendLine($"if ((obj is {type} {variable}))");
cb.AppendLine("{");
cb.AppendLine("var fieldsAreEqual =");
IEnumerable<FieldInfo> GetEquatableFields(FieldInfo[] fis)
=> fis.Where(fi => !fi.GetCustomAttributes().Any(a => a is IgnoreInEquality));
var entityFieldComparisons = GetEquatableFields(entityFields).Select(f => $"({f.Name} == {variable}.{f.Name})")
.Prepend($"(Index == {variable}.Index)");
var relationFieldComparisons = GetEquatableFields(relationFields)
.Select(f => $"({f.Name}?.Index == {variable}.{f.Name}?.Index)");
var comparisons = entityFieldComparisons.Concat(relationFieldComparisons).ToArray();
for (var i = 0; i < comparisons.Length; ++i)
{
var comparison = comparisons[i];
cb.AppendLine($" {comparison}{(i == comparisons.Length - 1 ? ";" : " &&")}");
}
cb.AppendLine("if (!fieldsAreEqual)");
cb.AppendLine("{");
cb.AppendLine("return false;");
cb.AppendLine("}");
cb.AppendLine();
cb.AppendLine("return true;");
cb.AppendLine("}");
return cb;
}
private static CodeBuilder WriteDocument(CodeBuilder cb)
{
var entityTypes = ObjectModelReflection.GetEntityTypes()
.ToArray();
foreach (var et in entityTypes)
WriteEntityClass(et, cb);
cb.AppendLine("public partial class DocumentModel");
cb.AppendLine("{");
cb.AppendLine("public ElementIndexMaps ElementIndexMaps { get; }");
var entityFields = new EntityFields();
foreach (var et in entityTypes)
WriteDocumentEntityData(et, cb, entityFields);
cb.AppendLine("// All entity collections");
cb.AppendLine("public Dictionary<string, IEnumerable<Entity>> AllEntities => new Dictionary<string, IEnumerable<Entity>>() {");
foreach (var t in entityTypes)
cb.AppendLine($"{{\"{t.GetEntityTableName()}\", {t.Name}List.ToEnumerable()}},");
cb.AppendLine("};");
cb.AppendLine();
cb.AppendLine("// Entity types from table names");
cb.AppendLine("public Dictionary<string, Type> EntityTypes => new Dictionary<string, Type>() {");
foreach (var t in entityTypes)
cb.AppendLine($"{{\"{t.GetEntityTableName()}\", typeof({t.Name})}},");
cb.AppendLine("};");
// Write the constructor
cb.AppendLine("public DocumentModel(Document d, bool inParallel = true)");
cb.AppendLine("{");
cb.AppendLine("Document = d;");
cb.AppendLine();
cb.AppendLine("// Initialize entity tables");
foreach (var line in entityFields.TableInitializers)
cb.AppendLine(line);
cb.AppendLine("");
cb.AppendLine("// Initialize entity arrays");
foreach (var line in entityFields.ArraysInitializers)
cb.AppendLine(line);
cb.AppendLine("");
cb.AppendLine("// Initialize entity relational columns");
foreach (var line in entityFields.RelationalColumns)
cb.AppendLine(line);
cb.AppendLine("");
cb.AppendLine("// Initialize entity collections");
foreach (var t in entityTypes)
cb.AppendLine($"{t.Name}List = Num{t.Name}.Select(i => Get{t.Name}(i));");
cb.AppendLine();
cb.AppendLine("// Initialize element index maps");
cb.AppendLine("ElementIndexMaps = new ElementIndexMaps(this, inParallel);");
cb.AppendLine("}");
cb.AppendLine("} // Document class");
cb.AppendLine();
return cb;
}
private static void WriteEntityTableSet(CodeBuilder cb)
{
var entityTypes = ObjectModelReflection.GetEntityTypes().ToArray();
cb.AppendLine("public partial class EntityTableSet");
cb.AppendLine("{");
cb.AppendLine(
"public Dictionary<string, SerializableEntityTable> RawTableMap { get; } = new Dictionary<string, SerializableEntityTable>();");
cb.AppendLine();
cb.AppendLine("private SerializableEntityTable GetRawTableOrDefault(string tableName)");
cb.AppendLine(" => RawTableMap.TryGetValue(tableName, out var result) ? result : null;");
cb.AppendLine();
cb.AppendLine("public ElementIndexMaps ElementIndexMaps { get; }");
cb.AppendLine();
cb.AppendLine("public EntityTableSet(SerializableEntityTable[] rawTables, string[] stringBuffer, bool inParallel = true)");
cb.AppendLine("{");
cb.AppendLine("foreach (var rawTable in rawTables)");
cb.AppendLine(" RawTableMap[rawTable.Name] = rawTable;");
cb.AppendLine();
cb.AppendLine("// Populate the entity tables.");
foreach (var t in entityTypes)
{
var etName = t.GetEntityTableName();
var tmp = $"{t.Name.ToLowerInvariant()}Table";
cb.AppendLine($"if (GetRawTableOrDefault(\"{etName}\") is SerializableEntityTable {tmp})");
cb.AppendLine($" {t.Name}Table = new {t.Name}Table({tmp}, stringBuffer);");
cb.AppendLine();
}
cb.AppendLine("// Initialize element index maps");
cb.AppendLine("ElementIndexMaps = new ElementIndexMaps(this, inParallel);");
cb.AppendLine();
cb.AppendLine("} // EntityTableSet constructor");
cb.AppendLine();
foreach (var t in entityTypes)
{
cb.AppendLine($"public {t.Name}Table {t.Name}Table {{ get; }} // can be null");
cb.AppendLine($"public {t.Name} Get{t.Name}(int index) => {t.Name}Table?.Get(index);");
}
cb.AppendLine("} // class EntityTableSet");
cb.AppendLine();
foreach (var t in entityTypes)
WriteEntityTable(cb, t);
}
private static void WriteEntityTable(CodeBuilder cb, Type t)
{
var entityFields = t.GetEntityFields().ToArray();
var relationFields = t.GetRelationFields().ToArray();
cb.AppendLine($"public partial class {t.Name}Table : EntityTable_v2, IEnumerable<{t.Name}>");
cb.AppendLine("{");
cb.AppendLine("private readonly EntityTableSet _parentTableSet; // can be null");
cb.AppendLine();
cb.AppendLine($"public {t.Name}Table(SerializableEntityTable rawTable, string[] stringBuffer, EntityTableSet parentTableSet = null) : base(rawTable, stringBuffer)");
cb.AppendLine("{");
cb.AppendLine("_parentTableSet = parentTableSet;");
foreach (var f in entityFields)
{
var fieldName = f.Name;
var fieldType = f.FieldType;
var fieldTypeName = f.FieldType.Name;
var loadingInfos = f.GetEntityColumnLoadingInfo();
var dataColumnGetters = loadingInfos.Select(eci =>
{
var functionName = eci.Strategy.GetEntityTable_v2GetterFunctionName(eci.EntityColumnAttribute.SerializedType);
var dataColumnGetter = $"{functionName}(\"{eci.SerializedValueColumnName}\")";
if (eci.EntityColumnAttribute.SerializedType != fieldType)
{
dataColumnGetter += $"?.Select(v => ({fieldTypeName}) v).ToArray()";
}
return dataColumnGetter;
}).ToArray();
var dataColumnGetterString = dataColumnGetters.Length > 1
? $"({string.Join(" ?? ", dataColumnGetters)})"
: dataColumnGetters[0];
cb.AppendLine($"Column_{fieldName} = {dataColumnGetterString} ?? Array.Empty<{fieldTypeName}>();");
}
foreach (var f in relationFields)
{
var (indexColumnName, localFieldName) = f.GetIndexColumnInfo();
cb.AppendLine($"Column_{localFieldName}Index = GetIndexColumnValues(\"{indexColumnName}\") ?? Array.Empty<int>();");
}
cb.AppendLine("}");
cb.AppendLine();
foreach (var f in entityFields)
{
var fieldName = f.Name;
var fieldTypeName = f.FieldType.Name;
var loadingInfos = f.GetEntityColumnLoadingInfo();
var baseStrategy = loadingInfos[0].Strategy; // Invariant: there is always at least one entityColumnInfo (the default one)
var defaultValue = baseStrategy == ValueSerializationStrategy.SerializeAsStringColumn ? "\"\"" : "default";
cb.AppendLine($"public {fieldTypeName}[] Column_{fieldName} {{ get; }}");
cb.AppendLine($"public {fieldTypeName} Get{fieldName}(int index, {fieldTypeName} @default = {defaultValue}) => Column_{fieldName}.ElementAtOrDefault(index, @default);");
}
foreach (var f in relationFields)
{
var (_, localFieldName) = f.GetIndexColumnInfo();
var relType = f.FieldType.RelationTypeParameter();
cb.AppendLine($"public int[] Column_{localFieldName}Index {{ get; }}");
cb.AppendLine($"public int Get{localFieldName}Index(int index) => Column_{localFieldName}Index.ElementAtOrDefault(index, EntityRelation.None);");
cb.AppendLine($"public {relType.Name} Get{localFieldName}(int index) => _GetReferenced{localFieldName}(Get{localFieldName}Index(index));");
cb.AppendLine($"private {relType.Name} _GetReferenced{localFieldName}(int referencedIndex) => _parentTableSet.Get{relType.Name}(referencedIndex);");
}
cb.AppendLine("// Object Getter");
cb.AppendLine($"public {t.Name} Get(int index)");
cb.AppendLine("{");
cb.AppendLine("if (index < 0) return null;");
cb.AppendLine($"var r = new {t.Name}();");
cb.AppendLine("r.Index = index;");
foreach (var f in entityFields)
{
cb.AppendLine($"r.{f.Name} = Get{f.Name}(index);");
}
foreach (var f in relationFields)
{
var (_, localFieldName) = f.GetIndexColumnInfo();
var relType = f.FieldType.RelationTypeParameter();
cb.AppendLine($"r.{f.Name} = new Relation<{relType}>(Get{f.Name.Substring(1)}Index(index), _GetReferenced{localFieldName});");
}
cb.AppendLine("return r;");
cb.AppendLine("}");
cb.AppendLine("// Enumerator");
cb.AppendLine("IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();");
cb.AppendLine($"public IEnumerator<{t.Name}> GetEnumerator()");
cb.AppendLine("{");
cb.AppendLine("for (var i = 0; i < RowCount; ++i)");
cb.AppendLine(" yield return Get(i);");
cb.AppendLine("}");
cb.AppendLine($"}} // class {t.Name}Table ");
cb.AppendLine();
}
private static void WriteDocumentBuilder(CodeBuilder cb)
{
var entityTypes = ObjectModelReflection.GetEntityTypes()
.Where(t => !t.IsEntityTableBuffer())
.ToArray();
cb.AppendLine("public static class DocumentBuilderExtensions");
cb.AppendLine("{");
cb.AppendLine("public static Func<IEnumerable<Entity>, EntityTableBuilder> GetTableBuilderFunc(this Type type)");
cb.AppendLine("{");
foreach (var et in entityTypes)
cb.AppendLine($"if (type == typeof({et.Name})) return To{et.Name}TableBuilder;");
cb.AppendLine("throw new ArgumentException(nameof(type));");
cb.AppendLine("}");
foreach (var et in entityTypes)
{
var entityType = et.Name;
cb.AppendLine($"public static EntityTableBuilder To{entityType}TableBuilder(this IEnumerable<Entity> entities)");
cb.AppendLine("{");
cb.AppendLine($"var typedEntities = entities?.Cast<{entityType}>() ?? Enumerable.Empty<{entityType}>();");
var tableName = et.GetEntityTableName();
cb.AppendLine($"var tb = new EntityTableBuilder(\"{tableName}\");");
var entityFields = et.GetEntityFields().ToArray();
var relationFields = et.GetRelationFields().ToArray();
if ((entityFields.Length + relationFields.Length) == 0)
throw new Exception($"Entity table {tableName} does not contain any fields.");
foreach (var fieldInfo in entityFields)
{
var (strategy, _) = fieldInfo.FieldType.GetValueSerializationStrategyAndTypePrefix();
var functionName = strategy.GetEntityTableBuilderAddFunctionName(fieldInfo.FieldType);
cb.AppendLine($"tb.{functionName}(\"{fieldInfo.GetSerializedValueColumnName()}\", typedEntities.Select(x => x.{fieldInfo.Name}));");
}
foreach (var fieldInfo in relationFields)
{
var (indexColumnName, localFieldName) = fieldInfo.GetIndexColumnInfo();
cb.AppendLine($"tb.AddIndexColumn(\"{indexColumnName}\", typedEntities.Select(x => x._{localFieldName}?.Index ?? EntityRelation.None));");
}
cb.AppendLine("return tb;");
cb.AppendLine("}");
}
cb.AppendLine("} // DocumentBuilderExtensions");
cb.AppendLine();
cb.AppendLine("public partial class ObjectModelBuilder");
cb.AppendLine("{");
// NOTE: the following line must not be made static since the ObjectModelBuilder is instantiated upon each new export.
// Making this static will cause the contained EntityTableBuilders to accumulate data from previous exports during the lifetime of the program.
cb.AppendLine("public readonly Dictionary<Type, EntityTableBuilder> EntityTableBuilders = new Dictionary<Type, EntityTableBuilder>()");
cb.AppendLine("{");
foreach (var et in entityTypes)
cb.AppendLine($"{{typeof({et.Name}), new EntityTableBuilder()}},");
cb.AppendLine("};");
cb.AppendLine("} // ObjectModelBuilder");
}
public static void WriteDocument(string file)
{
try
{
var cb = new CodeBuilder();
cb.AppendLine("// AUTO-GENERATED FILE, DO NOT MODIFY.");
cb.AppendLine("// ReSharper disable All");
cb.AppendLine("using System;");
cb.AppendLine("using System.Collections;");
cb.AppendLine("using System.Collections.Generic;");
cb.AppendLine("using System.Linq;");
cb.AppendLine("using Vim.Math3d;");
cb.AppendLine("using Vim.LinqArray;");
cb.AppendLine("using Vim.Format.ObjectModel;");
cb.AppendLine("using Vim.Util;");
cb.AppendLine();
cb.AppendLine("namespace Vim.Format.ObjectModel {");
WriteDocument(cb);
WriteEntityTableSet(cb);
WriteDocumentBuilder(cb);
cb.AppendLine("} // namespace");
var content = cb.ToString();
File.WriteAllText(file, content);
}
catch (Exception e)
{
Console.WriteLine(e);
throw;
}
}
}