generate-dac 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/DAC_Utils.ts +6 -6
- package/src/interface.ts +2 -1
package/package.json
CHANGED
package/src/DAC_Utils.ts
CHANGED
|
@@ -314,7 +314,8 @@ export function dac_generate_dataServiceObject(tableName: string, schemas: Colum
|
|
|
314
314
|
const classTemplate = text_from_file(`${TEMPLATE_DIR}/templates/DataServiceObjects_Class_Template.cs`);
|
|
315
315
|
|
|
316
316
|
const strProperties = schemas.map((e, i) => {
|
|
317
|
-
|
|
317
|
+
// Use enum if enum is defined
|
|
318
|
+
return `public ${e.enum || get_SqlDbType(e.type).codeType} ${e.col_name.replace(/[ _]+/g, '')} { get; set; }`;
|
|
318
319
|
}).join('\n' + repeat("\t", 2));
|
|
319
320
|
|
|
320
321
|
let created_by_user = '';
|
|
@@ -374,7 +375,7 @@ export function dac_generate_conversions(tableName: string, schemas: ColumnSchem
|
|
|
374
375
|
const methodTemplate = text_from_file(`${TEMPLATE_DIR}/templates/MakeDSO_Template_Method.cs`);
|
|
375
376
|
|
|
376
377
|
const dsoFields = schemas.map((e, i) => {
|
|
377
|
-
return `ds${className}.${e.colName}
|
|
378
|
+
return `ds${className}.${e.colName} =${e.enum ? `(${e.enum})` : ''} db${className}.${e.col_name};`;
|
|
378
379
|
}).join('\n' + repeat("\t", 3));
|
|
379
380
|
|
|
380
381
|
const dbFields = schemas.map((e, i) => {
|
|
@@ -387,7 +388,7 @@ export function dac_generate_conversions(tableName: string, schemas: ColumnSchem
|
|
|
387
388
|
return `db${className}.${e.col_name} = DateTimeHelper.MakeDBDefaultValue(ds${className}.${e.colName});`;
|
|
388
389
|
}
|
|
389
390
|
|
|
390
|
-
return `db${className}.${e.col_name} = ds${className}.${e.colName};`;
|
|
391
|
+
return `db${className}.${e.col_name} = ds${className}.${e.colName}${e.enum ? `.GetHashCode()` : ''};`;
|
|
391
392
|
}).join('\n' + repeat("\t", 3));
|
|
392
393
|
|
|
393
394
|
let created_by_user = '';
|
|
@@ -709,10 +710,9 @@ export function DAC_Generate_From_XLSX(filePath: string, sheetIndex: number = 0)
|
|
|
709
710
|
content: schemas.join("\n\n\n")
|
|
710
711
|
});
|
|
711
712
|
|
|
712
|
-
const content =
|
|
713
|
-
${dropConstrains.join("\n")}
|
|
713
|
+
const content = `${dropConstrains.filter(e => e).join("\nGO\n")}
|
|
714
714
|
|
|
715
|
-
${dropTables.join("\n")}`;
|
|
715
|
+
${dropTables.join("\nGO\n")}`;
|
|
716
716
|
|
|
717
717
|
files.push({
|
|
718
718
|
name: 'table_schema_reset.sql',
|