Fixed EF Tooling
- Added factory class for EF tooling - Removed no longer needed Program.cs
This commit is contained in:
4 files changed
+44
-30
No files matched your search
@@ -0,0 +1,28 @@
|
||||
using Microsoft.EntityFrameworkCore.Design;
|
||||
|
||||
namespace DataModel.Database.Common;
|
||||
|
||||
/// <summary>
|
||||
/// This factory is used by the EF tooling e.g. to create migrations.
|
||||
/// </summary>
|
||||
public sealed class DataContextFactory : IDesignTimeDbContextFactory<DataContext>
|
||||
{
|
||||
private const string ENV_EF_TOOLING_DATABASE = "ENV_EF_TOOLING_DATABASE";
|
||||
|
||||
#region Implementation of IDesignTimeDbContextFactory<out DataContext>
|
||||
|
||||
/// <inheritdoc />
|
||||
public DataContext CreateDbContext(string[] args)
|
||||
{
|
||||
var dataFile = Environment.GetEnvironmentVariable(ENV_EF_TOOLING_DATABASE);
|
||||
if (string.IsNullOrWhiteSpace(dataFile))
|
||||
{
|
||||
Console.WriteLine("In order to use EF tooling, point the environment variable ENV_EF_TOOLING_DATABASE to the data file, which should be used for the EF tooling.");
|
||||
Environment.Exit(100);
|
||||
}
|
||||
|
||||
return Setup.CreateDatabaseInstance4Tooling(dataFile, false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -16,7 +16,7 @@ public sealed class TextElement
|
||||
|
||||
public bool IsMultiLine { get; set; } = false;
|
||||
|
||||
public Section Section { get; set; }
|
||||
public Section Section { get; set; } = new();
|
||||
|
||||
public List<Translation> Translations { get; set; } = new();
|
||||
|
||||
|
||||
Reference in new issue
Block a user