3 лаба готовая
This commit is contained in:
parent
4badc422e1
commit
91d799cb24
@ -1,5 +1,5 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using GarmentFactoryDatabaseImplement.Models;
|
||||||
using GarmentFactoryDatabaseImplement.Models;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -14,7 +14,7 @@ namespace GarmentFactoryDatabaseImplement
|
|||||||
{
|
{
|
||||||
if (optionsBuilder.IsConfigured == false)
|
if (optionsBuilder.IsConfigured == false)
|
||||||
{
|
{
|
||||||
optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=GarmentFactoryDatabaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS01;Initial Catalog=GarmentFactoryDatabaseFulll;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||||
}
|
}
|
||||||
base.OnConfiguring(optionsBuilder);
|
base.OnConfiguring(optionsBuilder);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|||||||
namespace GarmentFactoryDatabaseImplement.Migrations
|
namespace GarmentFactoryDatabaseImplement.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(GarmentFactoryDatabase))]
|
[DbContext(typeof(GarmentFactoryDatabase))]
|
||||||
[Migration("20240319190105_InitialCreate")]
|
[Migration("20240419160846_ImplementerAddition")]
|
||||||
partial class InitialCreate
|
partial class ImplementerAddition
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@ -78,6 +78,59 @@ namespace GarmentFactoryDatabaseImplement.Migrations
|
|||||||
b.ToTable("Orders");
|
b.ToTable("Orders");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Shop", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Address")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateOpening")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("ShopName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("TextilesMaximum")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Shops");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.ShopTextile", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ShopId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("TextileId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ShopId");
|
||||||
|
|
||||||
|
b.HasIndex("TextileId");
|
||||||
|
|
||||||
|
b.ToTable("ShopTextiles");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Textile", b =>
|
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Textile", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
@ -135,6 +188,25 @@ namespace GarmentFactoryDatabaseImplement.Migrations
|
|||||||
b.Navigation("Textile");
|
b.Navigation("Textile");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.ShopTextile", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("GarmentFactoryDatabaseImplement.Models.Shop", "Shop")
|
||||||
|
.WithMany("Textiles")
|
||||||
|
.HasForeignKey("ShopId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("GarmentFactoryDatabaseImplement.Models.Textile", "Textile")
|
||||||
|
.WithMany("ShopTextiles")
|
||||||
|
.HasForeignKey("TextileId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Shop");
|
||||||
|
|
||||||
|
b.Navigation("Textile");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.TextileComponent", b =>
|
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.TextileComponent", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("GarmentFactoryDatabaseImplement.Models.Component", "Component")
|
b.HasOne("GarmentFactoryDatabaseImplement.Models.Component", "Component")
|
||||||
@ -159,11 +231,18 @@ namespace GarmentFactoryDatabaseImplement.Migrations
|
|||||||
b.Navigation("TextileComponents");
|
b.Navigation("TextileComponents");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Shop", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Textiles");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Textile", b =>
|
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Textile", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Components");
|
b.Navigation("Components");
|
||||||
|
|
||||||
b.Navigation("Orders");
|
b.Navigation("Orders");
|
||||||
|
|
||||||
|
b.Navigation("ShopTextiles");
|
||||||
});
|
});
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
}
|
}
|
@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||||||
namespace GarmentFactoryDatabaseImplement.Migrations
|
namespace GarmentFactoryDatabaseImplement.Migrations
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class InitialCreate : Migration
|
public partial class ImplementerAddition : Migration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
@ -25,6 +25,22 @@ namespace GarmentFactoryDatabaseImplement.Migrations
|
|||||||
table.PrimaryKey("PK_Components", x => x.Id);
|
table.PrimaryKey("PK_Components", x => x.Id);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Shops",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
ShopName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Address = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
DateOpening = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
|
TextilesMaximum = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Shops", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "Textiles",
|
name: "Textiles",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@ -63,6 +79,33 @@ namespace GarmentFactoryDatabaseImplement.Migrations
|
|||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "ShopTextiles",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
ShopId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
TextileId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Count = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_ShopTextiles", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_ShopTextiles_Shops_ShopId",
|
||||||
|
column: x => x.ShopId,
|
||||||
|
principalTable: "Shops",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_ShopTextiles_Textiles_TextileId",
|
||||||
|
column: x => x.TextileId,
|
||||||
|
principalTable: "Textiles",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "TextileComponents",
|
name: "TextileComponents",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@ -95,6 +138,16 @@ namespace GarmentFactoryDatabaseImplement.Migrations
|
|||||||
table: "Orders",
|
table: "Orders",
|
||||||
column: "TextileId");
|
column: "TextileId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ShopTextiles_ShopId",
|
||||||
|
table: "ShopTextiles",
|
||||||
|
column: "ShopId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ShopTextiles_TextileId",
|
||||||
|
table: "ShopTextiles",
|
||||||
|
column: "TextileId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_TextileComponents_ComponentId",
|
name: "IX_TextileComponents_ComponentId",
|
||||||
table: "TextileComponents",
|
table: "TextileComponents",
|
||||||
@ -112,9 +165,15 @@ namespace GarmentFactoryDatabaseImplement.Migrations
|
|||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Orders");
|
name: "Orders");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "ShopTextiles");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "TextileComponents");
|
name: "TextileComponents");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Shops");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Components");
|
name: "Components");
|
||||||
|
|
@ -75,6 +75,59 @@ namespace GarmentFactoryDatabaseImplement.Migrations
|
|||||||
b.ToTable("Orders");
|
b.ToTable("Orders");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Shop", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Address")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateOpening")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("ShopName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("TextilesMaximum")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Shops");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.ShopTextile", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ShopId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("TextileId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ShopId");
|
||||||
|
|
||||||
|
b.HasIndex("TextileId");
|
||||||
|
|
||||||
|
b.ToTable("ShopTextiles");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Textile", b =>
|
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Textile", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
@ -132,6 +185,25 @@ namespace GarmentFactoryDatabaseImplement.Migrations
|
|||||||
b.Navigation("Textile");
|
b.Navigation("Textile");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.ShopTextile", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("GarmentFactoryDatabaseImplement.Models.Shop", "Shop")
|
||||||
|
.WithMany("Textiles")
|
||||||
|
.HasForeignKey("ShopId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("GarmentFactoryDatabaseImplement.Models.Textile", "Textile")
|
||||||
|
.WithMany("ShopTextiles")
|
||||||
|
.HasForeignKey("TextileId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Shop");
|
||||||
|
|
||||||
|
b.Navigation("Textile");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.TextileComponent", b =>
|
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.TextileComponent", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("GarmentFactoryDatabaseImplement.Models.Component", "Component")
|
b.HasOne("GarmentFactoryDatabaseImplement.Models.Component", "Component")
|
||||||
@ -156,11 +228,18 @@ namespace GarmentFactoryDatabaseImplement.Migrations
|
|||||||
b.Navigation("TextileComponents");
|
b.Navigation("TextileComponents");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Shop", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Textiles");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Textile", b =>
|
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Textile", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Components");
|
b.Navigation("Components");
|
||||||
|
|
||||||
b.Navigation("Orders");
|
b.Navigation("Orders");
|
||||||
|
|
||||||
|
b.Navigation("ShopTextiles");
|
||||||
});
|
});
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,10 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.16" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\GarmentFactoryContracts\GarmentFactoryContracts.csproj" />
|
<ProjectReference Include="..\GarmentFactoryContracts\GarmentFactoryContracts.csproj" />
|
||||||
<ProjectReference Include="..\GarmentFactoryDataModels\GarmentFactoryDataModels.csproj" />
|
<ProjectReference Include="..\GarmentFactoryDataModels\GarmentFactoryDataModels.csproj" />
|
||||||
|
Loading…
Reference in New Issue
Block a user