нужно еще сторедж классы сделать и формы начать пилить по-адекватному

This commit is contained in:
Елена Бакальская 2024-11-19 01:40:09 +04:00
parent 12844f798e
commit f1422b3632
2 changed files with 36 additions and 12 deletions

View File

@ -0,0 +1,19 @@
using Microsoft.EntityFrameworkCore;
using ShopDataBaseImplements.Models;
namespace ShopDataBaseImplements
{
public class DataBase : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=ShopInternetDB;Integrated Security=True;MultipleActiveResultSets=True;TrustServerCertificate=True");
}
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<Order> Orders { set; get; }
public virtual DbSet<OrderStatus> OrderStatuses { set; get; }
}
}

View File

@ -1,18 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Folder Include="Implements\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.16" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.16" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.16">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ShopContracts\ShopContracts.csproj" />
<ProjectReference Include="..\ShopDataModels\ShopDataModels.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ShopContracts\ShopContracts.csproj" />
<ProjectReference Include="..\ShopDataModels\ShopDataModels.csproj" />
</ItemGroup>
</Project>