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 @@ +