Skip to content

Commit

Permalink
Make DAB entity types more unique (#2653)
Browse files Browse the repository at this point in the history
* Make DAB entity types more unique

* fix using
  • Loading branch information
ErikEJ authored Nov 25, 2024
1 parent d000186 commit 10d68e7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Core/RevEng.Core.80/DabBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public string GetDabConfigCmdFile()

var databaseType = string.Empty;

var entityTypeNames = new HashSet<string>();

switch (options.DatabaseType)
{
case DatabaseType.Undefined:
Expand Down Expand Up @@ -112,6 +114,13 @@ public string GetDabConfigCmdFile()

var type = GenerateEntityName(dbObject.Name.Replace(" ", string.Empty, StringComparison.OrdinalIgnoreCase));

if (entityTypeNames.Contains(type))
{
type = $"{dbObject.Schema}{type}";
}

entityTypeNames.Add(type);

if (dbObject.PrimaryKey != null)
{
sb.AppendLine(CultureInfo.InvariantCulture, $"dab add \"{type}\" --source \"[{dbObject.Schema}].[{dbObject.Name}]\" --fields.include \"{columnList}\" --permissions \"anonymous:*\" ");
Expand All @@ -136,6 +145,13 @@ public string GetDabConfigCmdFile()

var type = GenerateEntityName(dbObject.Name.Replace(" ", string.Empty, StringComparison.OrdinalIgnoreCase));

if (entityTypeNames.Contains(type))
{
type = $"{type}View";
}

entityTypeNames.Add(type);

if (dbObject.PrimaryKey == null)
{
var strategy = "Id column";
Expand Down

0 comments on commit 10d68e7

Please sign in to comment.