Skip to content

Commit

Permalink
add DbContextCreateConstructor
Browse files Browse the repository at this point in the history
  • Loading branch information
barnuri committed Dec 8, 2024
1 parent 5ad2513 commit a7c60a4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
16 changes: 10 additions & 6 deletions CSharp.OpenSource.LinqToKql/ORMGen/ORMGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,17 @@ protected virtual async Task GenerateDbContextAsync(List<ORMGenaratedModel> mode
{
$"public partial class {Config.DbContextName} : {nameof(ORMKustoDbContext)}",
$"{{",

// ctor
$"{TAB}public {Config.DbContextName}(IKustoDbContextExecutor<{Config.DbContextName}> executor) : base(executor)",
$"{TAB}{{",
$"{TAB}}}",
"",
};
if (Config.DbContextCreateConstructor)
{
lines.AddRange(new List<string>
{
$"{TAB}public {Config.DbContextName}(IKustoDbContextExecutor<{Config.DbContextName}> executor) : base(executor)",
$"{TAB}{{",
$"{TAB}}}",
"",
});
}

// props
foreach (var (model, index) in models.Select((model, index) => (model, index)))
Expand Down
1 change: 1 addition & 0 deletions CSharp.OpenSource.LinqToKql/ORMGen/ORMGeneratorConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ public class ORMGeneratorConfig
public ILinqToKqlProviderExecutor ProviderExecutor { get; set; }
public bool FileScopedNamespaces { get; set; } = true;
public bool EnableNullable { get; set; } = true;
public bool DbContextCreateConstructor { get; set; } = true;
}

0 comments on commit a7c60a4

Please sign in to comment.