From c4734e7daf4380194acbd63802996e7e4acdb49c Mon Sep 17 00:00:00 2001 From: maxnes3 <112558334+maxnes3@users.noreply.github.com> Date: Thu, 14 Dec 2023 10:39:56 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=B4=D0=B0=D0=BB=20=D0=BB=D0=B0=D0=B1?= =?UTF-8?q?=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WinFormsProject/AppView/FormMain.resx | 62 +-------------- .../DateBaseImplement/DBContext.cs | 2 +- ...0231214060747_initMigrationMax.Designer.cs | 75 +++++++++++++++++++ .../20231214060747_initMigrationMax.cs | 22 ++++++ .../DateBaseImplement/Models/Type.cs | 2 +- 5 files changed, 100 insertions(+), 63 deletions(-) create mode 100644 WinFormsProject/DateBaseImplement/Migrations/20231214060747_initMigrationMax.Designer.cs create mode 100644 WinFormsProject/DateBaseImplement/Migrations/20231214060747_initMigrationMax.cs diff --git a/WinFormsProject/AppView/FormMain.resx b/WinFormsProject/AppView/FormMain.resx index afd9012..eb5684b 100644 --- a/WinFormsProject/AppView/FormMain.resx +++ b/WinFormsProject/AppView/FormMain.resx @@ -1,64 +1,4 @@ - - - + diff --git a/WinFormsProject/DateBaseImplement/DBContext.cs b/WinFormsProject/DateBaseImplement/DBContext.cs index f3d8c73..2898f33 100644 --- a/WinFormsProject/DateBaseImplement/DBContext.cs +++ b/WinFormsProject/DateBaseImplement/DBContext.cs @@ -14,7 +14,7 @@ namespace DateBaseImplement protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { if (!optionsBuilder.IsConfigured) - optionsBuilder.UseNpgsql(@"Host=localhost;Port=5432;Database=COP;Username=postgres;Password=postgres"); + optionsBuilder.UseNpgsql(@"Host=localhost;Port=5432;Database=COPArtyom;Username=courseuser;Password=courseuser"); base.OnConfiguring(optionsBuilder); } diff --git a/WinFormsProject/DateBaseImplement/Migrations/20231214060747_initMigrationMax.Designer.cs b/WinFormsProject/DateBaseImplement/Migrations/20231214060747_initMigrationMax.Designer.cs new file mode 100644 index 0000000..e2a7dc4 --- /dev/null +++ b/WinFormsProject/DateBaseImplement/Migrations/20231214060747_initMigrationMax.Designer.cs @@ -0,0 +1,75 @@ +// +using DateBaseImplement; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace DateBaseImplement.Migrations +{ + [DbContext(typeof(DBContext))] + [Migration("20231214060747_initMigrationMax")] + partial class initMigrationMax + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.14") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("DateBaseImplement.Models.Provider", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Logo") + .IsRequired() + .HasColumnType("bytea"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Number") + .IsRequired() + .HasColumnType("text"); + + b.Property("Type") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Providers"); + }); + + modelBuilder.Entity("DateBaseImplement.Models.Type", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Types"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/WinFormsProject/DateBaseImplement/Migrations/20231214060747_initMigrationMax.cs b/WinFormsProject/DateBaseImplement/Migrations/20231214060747_initMigrationMax.cs new file mode 100644 index 0000000..b3bfc06 --- /dev/null +++ b/WinFormsProject/DateBaseImplement/Migrations/20231214060747_initMigrationMax.cs @@ -0,0 +1,22 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace DateBaseImplement.Migrations +{ + /// + public partial class initMigrationMax : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/WinFormsProject/DateBaseImplement/Models/Type.cs b/WinFormsProject/DateBaseImplement/Models/Type.cs index 62d4db3..894c0c0 100644 --- a/WinFormsProject/DateBaseImplement/Models/Type.cs +++ b/WinFormsProject/DateBaseImplement/Models/Type.cs @@ -30,7 +30,7 @@ namespace DateBaseImplement.Models public void Update(TypeBindingModel model) { if (model == null) return; - model.Name = Name; + Name = model.Name; } public TypeViewModel GetViewModel => new()