create DatabaseImplement project
This commit is contained in:
parent
dc723db6b3
commit
a794921f82
@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComputerShopContracts", "Co
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComputerShopBusinessLogic", "ComputerShopBusinessLogic\ComputerShopBusinessLogic.csproj", "{82FCBA71-AC54-45C8-9B21-BCB3DF6E085B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComputerShopDatabaseImplement", "ComputerShopDatabaseImplement\ComputerShopDatabaseImplement.csproj", "{CDE4C963-67B5-47A6-A394-901E95EA40F7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -33,6 +35,10 @@ Global
|
||||
{82FCBA71-AC54-45C8-9B21-BCB3DF6E085B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{82FCBA71-AC54-45C8-9B21-BCB3DF6E085B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{82FCBA71-AC54-45C8-9B21-BCB3DF6E085B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CDE4C963-67B5-47A6-A394-901E95EA40F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CDE4C963-67B5-47A6-A394-901E95EA40F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CDE4C963-67B5-47A6-A394-901E95EA40F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CDE4C963-67B5-47A6-A394-901E95EA40F7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
20
ComputerShopDatabaseImplement/ComputerShopDatabase.cs
Normal file
20
ComputerShopDatabaseImplement/ComputerShopDatabase.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace ComputerShopDatabaseImplement
|
||||
{
|
||||
public class ComputerShopDatabase : DbContext
|
||||
{
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder OptionsBuilder)
|
||||
{
|
||||
if (!OptionsBuilder.IsConfigured)
|
||||
{
|
||||
OptionsBuilder.UseNpgsql(@"Host=localhost;Database=ComputerShop;Username=postgres;Password=admin");
|
||||
}
|
||||
|
||||
base.OnConfiguring(OptionsBuilder);
|
||||
|
||||
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
||||
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.18" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.18">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.11" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user