Skip to content

Commit

Permalink
add support for setting connection string key via options
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikEJ committed Aug 1, 2024
1 parent e88e00f commit ee7235f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
using RevEng.Core.Abstractions.Metadata;
using RevEng.Core.Abstractions.Model;

namespace RevEng.Core.DataApiBuilderBuilder
namespace RevEng.Core
{
public class DabBuilder
{
Expand Down Expand Up @@ -47,7 +47,7 @@ public string GetDabConfigCmdFile()

var fileName = Path.Combine(options.ProjectPath, "dab-config.cmd");

string databaseType = string.Empty;
var databaseType = string.Empty;

switch (options.DatabaseType)
{
Expand Down Expand Up @@ -86,7 +86,7 @@ public string GetDabConfigCmdFile()

sb.AppendLine(CultureInfo.InvariantCulture, $"@echo This cmd file creates a Data API Builder configuration based on the chosen database objects.");
sb.AppendLine(CultureInfo.InvariantCulture, $"@echo To run the cmd, create an .env file with the following contents:");
sb.AppendLine(CultureInfo.InvariantCulture, $"@echo dab-connection-string=your connection string");
sb.AppendLine(CultureInfo.InvariantCulture, $"@echo {options.ConnectionStringName}=your connection string");
sb.AppendLine(CultureInfo.InvariantCulture, $"@echo ** Make sure to exclude the .env file from source control **");
sb.AppendLine(CultureInfo.InvariantCulture, $"@echo **");

Expand Down Expand Up @@ -114,7 +114,7 @@ public string GetDabConfigCmdFile()

if (dbObject.PrimaryKey != null)
{
sb.AppendLine(CultureInfo.InvariantCulture, $"dab add \"{type}\" --source \"[{dbObject.Schema}].[{dbObject.Name}]\" --fields.include \"{columnList}\" --permissions \"anonymous:*\" ");
sb.AppendLine(CultureInfo.InvariantCulture, $"dab add \"{type}\" --source \"[{dbObject.Schema}].[{dbObject.Name}]\" --fields.include \"{columnList}\" --permissions \"anonymous:*\" ");
}
}

Expand Down
1 change: 0 additions & 1 deletion src/Core/efreveng60/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#if NET8_0
using RevEng.Common.Dab;
using RevEng.Core.DacpacReport;
using RevEng.Core.DataApiBuilderBuilder;
#endif
using RevEng.Core.Diagram;

Expand Down
3 changes: 3 additions & 0 deletions src/GUI/RevEng.Shared/Dab/DataApiBuilderOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ public class DataApiBuilderOptions
public string ProjectPath { get; set; }

public List<SerializationTableModel> Tables { get; set; }

public string Dacpac { get; set; }

public string ConnectionStringName { get; set; } = "dab-connection-string";
}
}

0 comments on commit ee7235f

Please sign in to comment.