From fab697e3d6cf19e5b15b5f699da04250b6f541ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B0=20=D0=9F=D0=BE=D1=82?= =?UTF-8?q?=D0=B0=D0=BF=D0=BE=D0=B2?= Date: Wed, 20 Nov 2024 12:42:08 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0=D0=BB=20=D0=BC?= =?UTF-8?q?=D0=B8=D0=B3=D1=80=D0=B0=D1=86=D0=B8=D1=8E=20=D0=B4=D0=BB=D1=8F?= =?UTF-8?q?=20=D0=B8=D0=BD=D0=B8=D1=86=D0=B8=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D0=B8=20=D0=91=D0=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InternetShopDatabase.cs | 2 +- ...0241120083224_InitialMigration.Designer.cs | 75 +++++++++++++++++++ .../20241120083224_InitialMigration.cs | 53 +++++++++++++ .../InternetShopDatabaseModelSnapshot.cs | 72 ++++++++++++++++++ .../InternetShopForms.csproj | 10 +++ 5 files changed, 211 insertions(+), 1 deletion(-) create mode 100644 InternetShop/InternetShopDatabase/Migrations/20241120083224_InitialMigration.Designer.cs create mode 100644 InternetShop/InternetShopDatabase/Migrations/20241120083224_InitialMigration.cs create mode 100644 InternetShop/InternetShopDatabase/Migrations/InternetShopDatabaseModelSnapshot.cs diff --git a/InternetShop/InternetShopDatabase/InternetShopDatabase.cs b/InternetShop/InternetShopDatabase/InternetShopDatabase.cs index f2f3024..1dc6700 100644 --- a/InternetShop/InternetShopDatabase/InternetShopDatabase.cs +++ b/InternetShop/InternetShopDatabase/InternetShopDatabase.cs @@ -9,7 +9,7 @@ namespace InternetShopDatabase { if (optionsBuilder.IsConfigured == false) { - optionsBuilder.UseSqlServer(@"Data Source=localhost;User Id=SA;Password=87cbn9y48392nu32;Initial Catalog=InternetShopDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); + optionsBuilder.UseSqlServer(@"Data Source=tcp:127.0.0.1;Initial Catalog=internetShopBase;User ID=SA;Password=87cbn9y48392nu32;TrustServerCertificate=true;"); } base.OnConfiguring(optionsBuilder); } diff --git a/InternetShop/InternetShopDatabase/Migrations/20241120083224_InitialMigration.Designer.cs b/InternetShop/InternetShopDatabase/Migrations/20241120083224_InitialMigration.Designer.cs new file mode 100644 index 0000000..93ddd9e --- /dev/null +++ b/InternetShop/InternetShopDatabase/Migrations/20241120083224_InitialMigration.Designer.cs @@ -0,0 +1,75 @@ +// +using InternetShopDatabase; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace InternetShopDatabase.Migrations +{ + [DbContext(typeof(InternetShopDatabase))] + [Migration("20241120083224_InitialMigration")] + partial class InitialMigration + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("InternetShopDatabase.Models.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CustomerEmail") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CustomerFIO") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ImagePath") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.PrimitiveCollection("ProductNames") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Orders"); + }); + + modelBuilder.Entity("InternetShopDatabase.Models.Product", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Products"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/InternetShop/InternetShopDatabase/Migrations/20241120083224_InitialMigration.cs b/InternetShop/InternetShopDatabase/Migrations/20241120083224_InitialMigration.cs new file mode 100644 index 0000000..ca20dd1 --- /dev/null +++ b/InternetShop/InternetShopDatabase/Migrations/20241120083224_InitialMigration.cs @@ -0,0 +1,53 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace InternetShopDatabase.Migrations +{ + /// + public partial class InitialMigration : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Orders", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + CustomerFIO = table.Column(type: "nvarchar(max)", nullable: false), + CustomerEmail = table.Column(type: "nvarchar(max)", nullable: false), + ImagePath = table.Column(type: "nvarchar(max)", nullable: false), + ProductNames = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Orders", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Products", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Products", x => x.Id); + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Orders"); + + migrationBuilder.DropTable( + name: "Products"); + } + } +} diff --git a/InternetShop/InternetShopDatabase/Migrations/InternetShopDatabaseModelSnapshot.cs b/InternetShop/InternetShopDatabase/Migrations/InternetShopDatabaseModelSnapshot.cs new file mode 100644 index 0000000..2a0484d --- /dev/null +++ b/InternetShop/InternetShopDatabase/Migrations/InternetShopDatabaseModelSnapshot.cs @@ -0,0 +1,72 @@ +// +using InternetShopDatabase; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace InternetShopDatabase.Migrations +{ + [DbContext(typeof(InternetShopDatabase))] + partial class InternetShopDatabaseModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("InternetShopDatabase.Models.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CustomerEmail") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CustomerFIO") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ImagePath") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.PrimitiveCollection("ProductNames") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Orders"); + }); + + modelBuilder.Entity("InternetShopDatabase.Models.Product", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Products"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/InternetShop/InternetShopForms/InternetShopForms.csproj b/InternetShop/InternetShopForms/InternetShopForms.csproj index 3e50774..a1bce66 100644 --- a/InternetShop/InternetShopForms/InternetShopForms.csproj +++ b/InternetShop/InternetShopForms/InternetShopForms.csproj @@ -11,7 +11,17 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + \ No newline at end of file