From 3156a6d518d8183ebc70edebdb1d8cacb23afc51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=9A=D1=83=D0=BA?= =?UTF-8?q?=D0=BB=D0=B5=D0=B2?= Date: Tue, 30 Apr 2024 20:14:53 +0400 Subject: [PATCH] =?UTF-8?q?=D1=81=D1=81=D1=81=D1=8E=D1=8E=D0=B4=D0=B0=20?= =?UTF-8?q?=D0=B3=D0=BE=D1=82=D0=BE=D0=B2=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CarCenterDatabaseImplement/CarCenterDb.cs | 35 +++++++++++++++++++---- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/CarCenterDatabaseImplement/CarCenterDb.cs b/CarCenterDatabaseImplement/CarCenterDb.cs index b9926a6..e30d474 100644 --- a/CarCenterDatabaseImplement/CarCenterDb.cs +++ b/CarCenterDatabaseImplement/CarCenterDb.cs @@ -1,7 +1,32 @@ -namespace CarCenterDatabaseImplement -{ - public class Class1 - { +using CarCenterDatabaseImplement.Models; +using Microsoft.EntityFrameworkCore; - } +namespace CarCenterDatabaseImplement +{ + public class CarCenterDb : DbContext + { + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + if (optionsBuilder.IsConfigured == false) + { + optionsBuilder.UseNpgsql(@" + Host=localhost; + Port=5432; + Database=CarCenter; + Username=postgres; + Password=postgres; + Include Error Detail=true"); + } + base.OnConfiguring(optionsBuilder); + } + + public virtual DbSet Implementers { set; get; } + public virtual DbSet Requirements { set; get; } + public virtual DbSet RequirementByCars { set; get; } + public virtual DbSet Directors { set; get; } + public virtual DbSet Clients { set; get; } + public virtual DbSet ClientsByCars { set; get; } + public virtual DbSet Accounts { set; get; } + public virtual DbSet Cars { set; get; } + } }