DbContext class separated.
This commit is contained in:
20
code/MessengerBroker.Db.Sql/BrokerSqlDbContext.cs
Normal file
20
code/MessengerBroker.Db.Sql/BrokerSqlDbContext.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
17
code/MessengerBroker.Db.Sql/MessengerBroker.Db.Sql.csproj
Normal file
17
code/MessengerBroker.Db.Sql/MessengerBroker.Db.Sql.csproj
Normal 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>
|
||||
Reference in New Issue
Block a user