From 2d9db74bce4a18be9a945f633c14cbe96a1c6ee9 Mon Sep 17 00:00:00 2001 From: dasha Date: Thu, 30 Mar 2023 14:06:44 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=BD=D1=84=D0=B8=D0=B3=D1=83?= =?UTF-8?q?=D1=80=D0=B0=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BeautySaloonDatabaseImplement.csproj | 1 + .../BeautySaloonDatabaseImplement/NewdbContext.cs | 8 +++++--- BeautySaloon/BeautySaloonView/App.config | 6 ++++++ BeautySaloon/BeautySaloonView/BeautySaloonView.csproj | 1 + 4 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 BeautySaloon/BeautySaloonView/App.config diff --git a/BeautySaloon/BeautySaloonDatabaseImplement/BeautySaloonDatabaseImplement.csproj b/BeautySaloon/BeautySaloonDatabaseImplement/BeautySaloonDatabaseImplement.csproj index 148ce06..bda41fc 100644 --- a/BeautySaloon/BeautySaloonDatabaseImplement/BeautySaloonDatabaseImplement.csproj +++ b/BeautySaloon/BeautySaloonDatabaseImplement/BeautySaloonDatabaseImplement.csproj @@ -14,6 +14,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/BeautySaloon/BeautySaloonDatabaseImplement/NewdbContext.cs b/BeautySaloon/BeautySaloonDatabaseImplement/NewdbContext.cs index 155b537..94eb7ed 100644 --- a/BeautySaloon/BeautySaloonDatabaseImplement/NewdbContext.cs +++ b/BeautySaloon/BeautySaloonDatabaseImplement/NewdbContext.cs @@ -1,4 +1,5 @@ using Microsoft.EntityFrameworkCore; +using System.Configuration; namespace BeautySaloonDatabaseImplement; @@ -26,9 +27,10 @@ public partial class NewdbContext : DbContext public virtual DbSet ServiceOrders { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) -#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263. - => optionsBuilder.UseNpgsql("Host=192.168.56.102;Port=5432;Database=newdb;Username=username123;Password=12345"); - + { + string connectString = ConfigurationManager.AppSettings["connect"]!; + optionsBuilder.UseNpgsql(connectString); + } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity(entity => diff --git a/BeautySaloon/BeautySaloonView/App.config b/BeautySaloon/BeautySaloonView/App.config new file mode 100644 index 0000000..9e27a94 --- /dev/null +++ b/BeautySaloon/BeautySaloonView/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/BeautySaloon/BeautySaloonView/BeautySaloonView.csproj b/BeautySaloon/BeautySaloonView/BeautySaloonView.csproj index 16107c0..bf593de 100644 --- a/BeautySaloon/BeautySaloonView/BeautySaloonView.csproj +++ b/BeautySaloon/BeautySaloonView/BeautySaloonView.csproj @@ -19,6 +19,7 @@ +