Add Application configuration #11
12
SqlData/Migrations/MysqlMigrations/MysqlMigrations.csproj
Normal file
12
SqlData/Migrations/MysqlMigrations/MysqlMigrations.csproj
Normal file
@ -0,0 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<BaseOutputPath>..\..\Persistence\bin\</BaseOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Persistence\Persistence.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
12
SqlData/Migrations/PsqlMigrations/PsqlMigrations.csproj
Normal file
12
SqlData/Migrations/PsqlMigrations/PsqlMigrations.csproj
Normal file
@ -0,0 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<BaseOutputPath>..\..\Persistence\bin\</BaseOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Persistence\Persistence.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
12
SqlData/Migrations/SqliteMigrations/SqliteMigrations.csproj
Normal file
12
SqlData/Migrations/SqliteMigrations/SqliteMigrations.csproj
Normal file
@ -0,0 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<BaseOutputPath>..\..\Persistence\bin\</BaseOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Persistence\Persistence.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -76,9 +76,12 @@ public static class DependencyInjection
|
||||
{
|
||||
return dbProvider switch
|
||||
{
|
||||
DatabaseProvider.Sqlite => options.UseSqlite(connection),
|
||||
DatabaseProvider.Mysql => options.UseMySql(connection, ServerVersion.AutoDetect(connection)),
|
||||
DatabaseProvider.Postgresql => options.UseNpgsql(connection),
|
||||
DatabaseProvider.Mysql => options.UseMySql(connection, ServerVersion.AutoDetect(connection),
|
||||
x => x.MigrationsAssembly("MysqlMigrations")),
|
||||
DatabaseProvider.Sqlite => options.UseSqlite(connection,
|
||||
x => x.MigrationsAssembly("SqliteMigrations")),
|
||||
DatabaseProvider.Postgresql => options.UseNpgsql(connection,
|
||||
x => x.MigrationsAssembly("PsqlMigrations")),
|
||||
_ => throw new ArgumentException("Unsupported database provider", Enum.GetName(dbProvider))
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user