diff --git a/I18N Commander/DataModel/DataModel.csproj b/I18N Commander/DataModel/DataModel.csproj
new file mode 100644
index 0000000..07d4dfb
--- /dev/null
+++ b/I18N Commander/DataModel/DataModel.csproj
@@ -0,0 +1,24 @@
+
+
+
+ Exe
+ net6.0
+ enable
+ enable
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+
+
+
diff --git a/I18N Commander/DataModel/Database/Common/DataContext.cs b/I18N Commander/DataModel/Database/Common/DataContext.cs
new file mode 100644
index 0000000..43d1c5d
--- /dev/null
+++ b/I18N Commander/DataModel/Database/Common/DataContext.cs
@@ -0,0 +1,28 @@
+using Microsoft.EntityFrameworkCore;
+
+namespace DataModel.Database.Common;
+
+public sealed class DataContext : DbContext
+{
+ public DbSet? Settings { get; set; }
+
+ public DataContext(DbContextOptions contextOptions) : base(contextOptions)
+ {
+ }
+
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
+ {
+ base.OnModelCreating(modelBuilder);
+
+ #region Ideas
+
+ modelBuilder.Entity().HasIndex(n => n.Id);
+ modelBuilder.Entity().HasIndex(n => n.Name).IsUnique();
+ modelBuilder.Entity().HasIndex(n => n.BoolValue);
+ modelBuilder.Entity().HasIndex(n => n.GuidValue);
+ modelBuilder.Entity().HasIndex(n => n.IntegerValue);
+ modelBuilder.Entity().HasIndex(n => n.TextValue);
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/I18N Commander/DataModel/Database/Setting.cs b/I18N Commander/DataModel/Database/Setting.cs
new file mode 100644
index 0000000..3f847d6
--- /dev/null
+++ b/I18N Commander/DataModel/Database/Setting.cs
@@ -0,0 +1,19 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace DataModel.Database;
+
+public class Setting
+{
+ [Key]
+ public int Id { get; set; }
+
+ public string Name { get; set; } = string.Empty;
+
+ public string TextValue { get; set; } = string.Empty;
+
+ public bool BoolValue { get; set; }
+
+ public int IntegerValue { get; set; }
+
+ public Guid GuidValue { get; set; }
+}
\ No newline at end of file
diff --git a/I18N Commander/DataModel/Migrations/20220612151133_202206AddSettings.Designer.cs b/I18N Commander/DataModel/Migrations/20220612151133_202206AddSettings.Designer.cs
new file mode 100644
index 0000000..50afbab
--- /dev/null
+++ b/I18N Commander/DataModel/Migrations/20220612151133_202206AddSettings.Designer.cs
@@ -0,0 +1,65 @@
+//
+using System;
+using DataModel.Database.Common;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace DataModel.Migrations
+{
+ [DbContext(typeof(DataContext))]
+ [Migration("20220612151133_202206AddSettings")]
+ partial class _202206AddSettings
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder.HasAnnotation("ProductVersion", "6.0.5");
+
+ modelBuilder.Entity("DataModel.Database.Setting", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("BoolValue")
+ .HasColumnType("INTEGER");
+
+ b.Property("GuidValue")
+ .HasColumnType("TEXT");
+
+ b.Property("IntegerValue")
+ .HasColumnType("INTEGER");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("TextValue")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("BoolValue");
+
+ b.HasIndex("GuidValue");
+
+ b.HasIndex("Id");
+
+ b.HasIndex("IntegerValue");
+
+ b.HasIndex("Name")
+ .IsUnique();
+
+ b.HasIndex("TextValue");
+
+ b.ToTable("Settings");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/I18N Commander/DataModel/Migrations/20220612151133_202206AddSettings.cs b/I18N Commander/DataModel/Migrations/20220612151133_202206AddSettings.cs
new file mode 100644
index 0000000..22de1af
--- /dev/null
+++ b/I18N Commander/DataModel/Migrations/20220612151133_202206AddSettings.cs
@@ -0,0 +1,67 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace DataModel.Migrations
+{
+ public partial class _202206AddSettings : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "Settings",
+ columns: table => new
+ {
+ Id = table.Column(type: "INTEGER", nullable: false)
+ .Annotation("Sqlite:Autoincrement", true),
+ Name = table.Column(type: "TEXT", nullable: false),
+ TextValue = table.Column(type: "TEXT", nullable: false),
+ BoolValue = table.Column(type: "INTEGER", nullable: false),
+ IntegerValue = table.Column(type: "INTEGER", nullable: false),
+ GuidValue = table.Column(type: "TEXT", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Settings", x => x.Id);
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Settings_BoolValue",
+ table: "Settings",
+ column: "BoolValue");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Settings_GuidValue",
+ table: "Settings",
+ column: "GuidValue");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Settings_Id",
+ table: "Settings",
+ column: "Id");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Settings_IntegerValue",
+ table: "Settings",
+ column: "IntegerValue");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Settings_Name",
+ table: "Settings",
+ column: "Name",
+ unique: true);
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Settings_TextValue",
+ table: "Settings",
+ column: "TextValue");
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "Settings");
+ }
+ }
+}
diff --git a/I18N Commander/DataModel/Migrations/DataContextModelSnapshot.cs b/I18N Commander/DataModel/Migrations/DataContextModelSnapshot.cs
new file mode 100644
index 0000000..4bfc41b
--- /dev/null
+++ b/I18N Commander/DataModel/Migrations/DataContextModelSnapshot.cs
@@ -0,0 +1,63 @@
+//
+using System;
+using DataModel.Database.Common;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace DataModel.Migrations
+{
+ [DbContext(typeof(DataContext))]
+ partial class DataContextModelSnapshot : ModelSnapshot
+ {
+ protected override void BuildModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder.HasAnnotation("ProductVersion", "6.0.5");
+
+ modelBuilder.Entity("DataModel.Database.Setting", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("BoolValue")
+ .HasColumnType("INTEGER");
+
+ b.Property("GuidValue")
+ .HasColumnType("TEXT");
+
+ b.Property("IntegerValue")
+ .HasColumnType("INTEGER");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("TextValue")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("BoolValue");
+
+ b.HasIndex("GuidValue");
+
+ b.HasIndex("Id");
+
+ b.HasIndex("IntegerValue");
+
+ b.HasIndex("Name")
+ .IsUnique();
+
+ b.HasIndex("TextValue");
+
+ b.ToTable("Settings");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/I18N Commander/DataModel/Program.cs b/I18N Commander/DataModel/Program.cs
new file mode 100644
index 0000000..d07d548
--- /dev/null
+++ b/I18N Commander/DataModel/Program.cs
@@ -0,0 +1,13 @@
+using Microsoft.Extensions.Hosting;
+namespace DataModel;
+
+public static class Program
+{
+ public static void Main(string[] args)
+ {
+ Console.WriteLine("This app is intended for the EF tooling. You cannot start this data project, though.");
+ Environment.Exit(0);
+ }
+
+ public static IHostBuilder CreateHostBuilder(string[] args) => Setup.Setup4EFTooling(args);
+}
\ No newline at end of file
diff --git a/I18N Commander/DataModel/Setup.cs b/I18N Commander/DataModel/Setup.cs
new file mode 100644
index 0000000..44e32d8
--- /dev/null
+++ b/I18N Commander/DataModel/Setup.cs
@@ -0,0 +1,56 @@
+using DataModel.Database.Common;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Hosting;
+
+namespace DataModel;
+
+public static class Setup
+{
+ private const string ENV_EF_TOOLING_DATABASE = "ENV_EF_TOOLING_DATABASE";
+ private const string DB_READ_WRITE_MODE = "ReadWrite";
+ private const string DB_READ_WRITE_CREATE_MODE = "ReadWriteCreate";
+
+ ///
+ /// Tries to migrate the data file.
+ ///
+ public static async Task PerformDataMigration(DataContext dbContext)
+ {
+ var pendingMigrations = (await dbContext.Database.GetPendingMigrationsAsync()).ToList();
+ foreach (var pendingMigration in pendingMigrations)
+ {
+ Console.WriteLine($"The migration '{pendingMigration}' is pending.");
+ }
+
+ await dbContext.Database.MigrateAsync();
+ }
+
+ ///
+ /// Add the database to the DI system
+ ///
+ public static void AddDatabase(this IServiceCollection serviceCollection, string path2DataFile, bool createWhenNecessary = true)
+ {
+ serviceCollection.AddDbContext(options => options.UseSqlite($"Filename={path2DataFile};Mode={(createWhenNecessary ? DB_READ_WRITE_CREATE_MODE : DB_READ_WRITE_MODE)}"));
+ }
+
+ ///
+ /// Sets up the DI & db context ready for the EF tooling.
+ ///
+ public static IHostBuilder Setup4EFTooling(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);
+ }
+
+ var builder = Host.CreateDefaultBuilder(args);
+ builder.ConfigureServices((hostContext, serviceCollection) =>
+ {
+ serviceCollection.AddDbContext(options => options.UseSqlite($"Filename={dataFile};Mode=ReadWriteCreate"));
+ });
+
+ return builder;
+ }
+}
diff --git a/I18N Commander/DataModel/cmdAddMigration.cmd b/I18N Commander/DataModel/cmdAddMigration.cmd
new file mode 100644
index 0000000..7d9244e
--- /dev/null
+++ b/I18N Commander/DataModel/cmdAddMigration.cmd
@@ -0,0 +1,4 @@
+@echo off
+set /p migrationName="Please enter the new migration's name: "
+dotnet tool update --global dotnet-ef
+dotnet ef migrations add %migrationName%
diff --git a/I18N Commander/DataModel/cmdUndoMigration.cmd b/I18N Commander/DataModel/cmdUndoMigration.cmd
new file mode 100644
index 0000000..992113f
--- /dev/null
+++ b/I18N Commander/DataModel/cmdUndoMigration.cmd
@@ -0,0 +1,4 @@
+@echo off
+set /p migrationName="Please enter the migration's name which should be the **ACTIVE** one: "
+dotnet tool update --global dotnet-ef
+dotnet ef database update %migrationName%
diff --git a/I18N Commander/I18N Commander.sln b/I18N Commander/I18N Commander.sln
index f97190f..53e4473 100644
--- a/I18N Commander/I18N Commander.sln
+++ b/I18N Commander/I18N Commander.sln
@@ -5,7 +5,9 @@ VisualStudioVersion = 17.3.32519.111
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Processor", "Processor\Processor.csproj", "{E24B7026-05BE-434D-9481-7CA5785BC7A8}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UI WinForms", "UI WinForms\UI WinForms.csproj", "{5AE84E7C-3141-46CA-B390-4E42878B6195}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UI WinForms", "UI WinForms\UI WinForms.csproj", "{5AE84E7C-3141-46CA-B390-4E42878B6195}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataModel", "DataModel\DataModel.csproj", "{D18DD193-3F93-4D21-92DC-BA0E26B0342A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -21,6 +23,10 @@ Global
{5AE84E7C-3141-46CA-B390-4E42878B6195}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5AE84E7C-3141-46CA-B390-4E42878B6195}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5AE84E7C-3141-46CA-B390-4E42878B6195}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D18DD193-3F93-4D21-92DC-BA0E26B0342A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D18DD193-3F93-4D21-92DC-BA0E26B0342A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D18DD193-3F93-4D21-92DC-BA0E26B0342A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D18DD193-3F93-4D21-92DC-BA0E26B0342A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/I18N Commander/Processor/Processor.csproj b/I18N Commander/Processor/Processor.csproj
index a8fca95..94a5986 100644
--- a/I18N Commander/Processor/Processor.csproj
+++ b/I18N Commander/Processor/Processor.csproj
@@ -7,4 +7,8 @@
default
+
+
+
+
diff --git a/I18N Commander/UI WinForms/UI WinForms.csproj b/I18N Commander/UI WinForms/UI WinForms.csproj
index 9b0d15f..dc5c59a 100644
--- a/I18N Commander/UI WinForms/UI WinForms.csproj
+++ b/I18N Commander/UI WinForms/UI WinForms.csproj
@@ -11,6 +11,7 @@
+
diff --git a/project for migrations.i18nc b/project for migrations.i18nc
new file mode 100644
index 0000000..e69de29