DbContext class separated.

This commit is contained in:
2025-07-05 08:47:19 +02:00
parent f96de8936d
commit 8735510dfc
6 changed files with 39 additions and 37 deletions

View File

@ -0,0 +1,20 @@
using Microsoft.EntityFrameworkCore;
namespace MessengerBroker.Db.Sql
{
public class BrokerSqlDbContext : BrokerDbContext
{
private readonly string connectionString;
public BrokerSqlDbContext(string connectionString)
{
this.connectionString = connectionString;
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
base.OnConfiguring(optionsBuilder);
optionsBuilder.UseSqlServer(this.connectionString);
}
}
}

View File

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.6" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MessengerBroker.Db\MessengerBroker.Db.csproj" />
</ItemGroup>
</Project>