From 40ad8979c58e0892286b61455d51fc29d75c6812 Mon Sep 17 00:00:00 2001 From: goblinrf Date: Sat, 16 Mar 2024 20:18:37 +0400 Subject: [PATCH] Done --- .../DinerBusinessLogic.csproj | 8 +- AbstractShopContracts/DinerContracts.csproj | 9 + AbstractShopDataModels/DinerDataModels.csproj | 9 + .../DinerListImplement.csproj | 9 + Diner/Diner/DinerView.csproj | 6 + .../DinerDataBaseImplement.csproj | 4 + Diner/DinerDataBaseImplement/DinerDatabase.cs | 2 +- .../20240316161514_InitialCreate.Designer.cs | 171 ++++++++++++++++++ .../20240316161514_InitialCreate.cs | 125 +++++++++++++ .../Migrations/DinerDatabaseModelSnapshot.cs | 168 +++++++++++++++++ .../DinerFileImplement.csproj | 9 + 11 files changed, 518 insertions(+), 2 deletions(-) create mode 100644 Diner/DinerDataBaseImplement/Migrations/20240316161514_InitialCreate.Designer.cs create mode 100644 Diner/DinerDataBaseImplement/Migrations/20240316161514_InitialCreate.cs create mode 100644 Diner/DinerDataBaseImplement/Migrations/DinerDatabaseModelSnapshot.cs diff --git a/AbstractShopBusinessLogic/DinerBusinessLogic.csproj b/AbstractShopBusinessLogic/DinerBusinessLogic.csproj index 6c7b98e..ff38baf 100644 --- a/AbstractShopBusinessLogic/DinerBusinessLogic.csproj +++ b/AbstractShopBusinessLogic/DinerBusinessLogic.csproj @@ -1,4 +1,4 @@ - + net6.0 @@ -7,6 +7,12 @@ + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/AbstractShopContracts/DinerContracts.csproj b/AbstractShopContracts/DinerContracts.csproj index bdec9f1..692b9c3 100644 --- a/AbstractShopContracts/DinerContracts.csproj +++ b/AbstractShopContracts/DinerContracts.csproj @@ -6,6 +6,15 @@ enable + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + diff --git a/AbstractShopDataModels/DinerDataModels.csproj b/AbstractShopDataModels/DinerDataModels.csproj index 132c02c..f977952 100644 --- a/AbstractShopDataModels/DinerDataModels.csproj +++ b/AbstractShopDataModels/DinerDataModels.csproj @@ -6,4 +6,13 @@ enable + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + diff --git a/Diner/AbstractShopListImplement/DinerListImplement.csproj b/Diner/AbstractShopListImplement/DinerListImplement.csproj index 51f4155..85bb64d 100644 --- a/Diner/AbstractShopListImplement/DinerListImplement.csproj +++ b/Diner/AbstractShopListImplement/DinerListImplement.csproj @@ -6,6 +6,15 @@ enable + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + diff --git a/Diner/Diner/DinerView.csproj b/Diner/Diner/DinerView.csproj index ebcc4c3..6aeddc0 100644 --- a/Diner/Diner/DinerView.csproj +++ b/Diner/Diner/DinerView.csproj @@ -9,10 +9,16 @@ + all runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Diner/DinerDataBaseImplement/DinerDataBaseImplement.csproj b/Diner/DinerDataBaseImplement/DinerDataBaseImplement.csproj index b38577a..caf5076 100644 --- a/Diner/DinerDataBaseImplement/DinerDataBaseImplement.csproj +++ b/Diner/DinerDataBaseImplement/DinerDataBaseImplement.csproj @@ -10,6 +10,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Diner/DinerDataBaseImplement/DinerDatabase.cs b/Diner/DinerDataBaseImplement/DinerDatabase.cs index 02c1ce1..f3f976b 100644 --- a/Diner/DinerDataBaseImplement/DinerDatabase.cs +++ b/Diner/DinerDataBaseImplement/DinerDatabase.cs @@ -9,7 +9,7 @@ namespace DinerDataBaseImplement { if (optionsBuilder.IsConfigured == false) { - optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-BUS07H5\SQLEXPRESS;Initial Catalog=DinerDatabaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); + optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS01;Initial Catalog=DinerDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); } base.OnConfiguring(optionsBuilder); } diff --git a/Diner/DinerDataBaseImplement/Migrations/20240316161514_InitialCreate.Designer.cs b/Diner/DinerDataBaseImplement/Migrations/20240316161514_InitialCreate.Designer.cs new file mode 100644 index 0000000..b977184 --- /dev/null +++ b/Diner/DinerDataBaseImplement/Migrations/20240316161514_InitialCreate.Designer.cs @@ -0,0 +1,171 @@ +// +using System; +using DinerDataBaseImplement; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace DinerDataBaseImplement.Migrations +{ + [DbContext(typeof(DinerDatabase))] + [Migration("20240316161514_InitialCreate")] + partial class InitialCreate + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.14") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("DinerDataBaseImplement.Models.Component", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ComponentName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Cost") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.ToTable("Components"); + }); + + modelBuilder.Entity("DinerDataBaseImplement.Models.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateImplement") + .HasColumnType("datetime2"); + + b.Property("SnackId") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Sum") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("SnackId"); + + b.ToTable("Orders"); + }); + + modelBuilder.Entity("DinerDataBaseImplement.Models.Snack", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Price") + .HasColumnType("float"); + + b.Property("SnackName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Snacks"); + }); + + modelBuilder.Entity("DinerDataBaseImplement.Models.SnackComponent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ComponentId") + .HasColumnType("int"); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("SnackId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ComponentId"); + + b.HasIndex("SnackId"); + + b.ToTable("SnackComponents"); + }); + + modelBuilder.Entity("DinerDataBaseImplement.Models.Order", b => + { + b.HasOne("DinerDataBaseImplement.Models.Snack", "Snack") + .WithMany("Orders") + .HasForeignKey("SnackId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Snack"); + }); + + modelBuilder.Entity("DinerDataBaseImplement.Models.SnackComponent", b => + { + b.HasOne("DinerDataBaseImplement.Models.Component", "Component") + .WithMany("SnackComponents") + .HasForeignKey("ComponentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DinerDataBaseImplement.Models.Snack", "Snack") + .WithMany("Components") + .HasForeignKey("SnackId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Component"); + + b.Navigation("Snack"); + }); + + modelBuilder.Entity("DinerDataBaseImplement.Models.Component", b => + { + b.Navigation("SnackComponents"); + }); + + modelBuilder.Entity("DinerDataBaseImplement.Models.Snack", b => + { + b.Navigation("Components"); + + b.Navigation("Orders"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Diner/DinerDataBaseImplement/Migrations/20240316161514_InitialCreate.cs b/Diner/DinerDataBaseImplement/Migrations/20240316161514_InitialCreate.cs new file mode 100644 index 0000000..8b8f004 --- /dev/null +++ b/Diner/DinerDataBaseImplement/Migrations/20240316161514_InitialCreate.cs @@ -0,0 +1,125 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace DinerDataBaseImplement.Migrations +{ + /// + public partial class InitialCreate : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Components", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ComponentName = table.Column(type: "nvarchar(max)", nullable: false), + Cost = table.Column(type: "float", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Components", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Snacks", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + SnackName = table.Column(type: "nvarchar(max)", nullable: false), + Price = table.Column(type: "float", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Snacks", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Orders", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + SnackId = table.Column(type: "int", nullable: false), + Count = table.Column(type: "int", nullable: false), + Sum = table.Column(type: "float", nullable: false), + Status = table.Column(type: "int", nullable: false), + DateCreate = table.Column(type: "datetime2", nullable: false), + DateImplement = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Orders", x => x.Id); + table.ForeignKey( + name: "FK_Orders_Snacks_SnackId", + column: x => x.SnackId, + principalTable: "Snacks", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "SnackComponents", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + SnackId = table.Column(type: "int", nullable: false), + ComponentId = table.Column(type: "int", nullable: false), + Count = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_SnackComponents", x => x.Id); + table.ForeignKey( + name: "FK_SnackComponents_Components_ComponentId", + column: x => x.ComponentId, + principalTable: "Components", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_SnackComponents_Snacks_SnackId", + column: x => x.SnackId, + principalTable: "Snacks", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Orders_SnackId", + table: "Orders", + column: "SnackId"); + + migrationBuilder.CreateIndex( + name: "IX_SnackComponents_ComponentId", + table: "SnackComponents", + column: "ComponentId"); + + migrationBuilder.CreateIndex( + name: "IX_SnackComponents_SnackId", + table: "SnackComponents", + column: "SnackId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Orders"); + + migrationBuilder.DropTable( + name: "SnackComponents"); + + migrationBuilder.DropTable( + name: "Components"); + + migrationBuilder.DropTable( + name: "Snacks"); + } + } +} diff --git a/Diner/DinerDataBaseImplement/Migrations/DinerDatabaseModelSnapshot.cs b/Diner/DinerDataBaseImplement/Migrations/DinerDatabaseModelSnapshot.cs new file mode 100644 index 0000000..ff286ab --- /dev/null +++ b/Diner/DinerDataBaseImplement/Migrations/DinerDatabaseModelSnapshot.cs @@ -0,0 +1,168 @@ +// +using System; +using DinerDataBaseImplement; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace DinerDataBaseImplement.Migrations +{ + [DbContext(typeof(DinerDatabase))] + partial class DinerDatabaseModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.14") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("DinerDataBaseImplement.Models.Component", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ComponentName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Cost") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.ToTable("Components"); + }); + + modelBuilder.Entity("DinerDataBaseImplement.Models.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateImplement") + .HasColumnType("datetime2"); + + b.Property("SnackId") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Sum") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("SnackId"); + + b.ToTable("Orders"); + }); + + modelBuilder.Entity("DinerDataBaseImplement.Models.Snack", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Price") + .HasColumnType("float"); + + b.Property("SnackName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Snacks"); + }); + + modelBuilder.Entity("DinerDataBaseImplement.Models.SnackComponent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ComponentId") + .HasColumnType("int"); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("SnackId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ComponentId"); + + b.HasIndex("SnackId"); + + b.ToTable("SnackComponents"); + }); + + modelBuilder.Entity("DinerDataBaseImplement.Models.Order", b => + { + b.HasOne("DinerDataBaseImplement.Models.Snack", "Snack") + .WithMany("Orders") + .HasForeignKey("SnackId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Snack"); + }); + + modelBuilder.Entity("DinerDataBaseImplement.Models.SnackComponent", b => + { + b.HasOne("DinerDataBaseImplement.Models.Component", "Component") + .WithMany("SnackComponents") + .HasForeignKey("ComponentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DinerDataBaseImplement.Models.Snack", "Snack") + .WithMany("Components") + .HasForeignKey("SnackId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Component"); + + b.Navigation("Snack"); + }); + + modelBuilder.Entity("DinerDataBaseImplement.Models.Component", b => + { + b.Navigation("SnackComponents"); + }); + + modelBuilder.Entity("DinerDataBaseImplement.Models.Snack", b => + { + b.Navigation("Components"); + + b.Navigation("Orders"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Diner/DinerFileImplement/DinerFileImplement.csproj b/Diner/DinerFileImplement/DinerFileImplement.csproj index f83c53f..031588f 100644 --- a/Diner/DinerFileImplement/DinerFileImplement.csproj +++ b/Diner/DinerFileImplement/DinerFileImplement.csproj @@ -6,6 +6,15 @@ enable + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + +