Compare commits

...

3 Commits

2 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,24 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CarCenterDatabaseImplement
{
public class CarCenterDatabase : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseNpgsql(@"Host=localhost;Database=CarCenterDatabaseFull;Username=postgres;Password=postgres");
}
base.OnConfiguring(optionsBuilder);
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
}
}
}

View File

@ -11,6 +11,15 @@
<Folder Include="Implements\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.29" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.29">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.22" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CarCenterContracts\CarCenterContracts.csproj" />
<ProjectReference Include="..\CarCenterDataModels\CarCenterDataModels.csproj" />