Feature/update net 5 (#487)

* Updated ApplicationCore to net 5

* Updated Infrastructure project to net 5

* Updated BlazorShared project to net 5

* Updated PublicApi project to net 5

* Updated Web mvc project to net 5

* Updated BlazorAdmin project to net-5

* Updated FunctionalTests to net 5

* Updated UnitTests project to net 5

* Updated IntegrationTests project to net 5

* Fixed CSS specific bug in BlazorAdmin project

* Updated github action worflow yaml

* Changes the name to only .NET

* Removed hardcoded minor version from github action workflow.

* Removed commneted code.

* Removed minor versions from the docker file

* Updated dotnet-ef tool version configuration to net-5

* Removed old migration plans

* Added net5 migration plans

* Updated infrastructure projecti setting.

* Removed database error page related configuration

* Removed commented package.
This commit is contained in:
Sumit Ghosh
2020-12-03 21:53:11 +05:30
committed by GitHub
parent 3463c89418
commit 28af1642f6
42 changed files with 830 additions and 2917 deletions

View File

@@ -1,225 +0,0 @@
// <auto-generated />
using Microsoft.eShopWeb.Infrastructure.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Storage.Internal;
using System;
namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
{
[DbContext(typeof(CatalogContext))]
[Migration("20171018175735_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.0.0-rtm-26452")
.HasAnnotation("Relational:Sequence:.catalog_brand_hilo", "'catalog_brand_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("Relational:Sequence:.catalog_hilo", "'catalog_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("Relational:Sequence:.catalog_type_hilo", "'catalog_type_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("ApplicationCore.Entities.OrderAggregate.Order", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("BuyerId");
b.Property<DateTimeOffset>("OrderDate");
b.HasKey("Id");
b.ToTable("Orders");
});
modelBuilder.Entity("ApplicationCore.Entities.OrderAggregate.OrderItem", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("OrderId");
b.Property<decimal>("UnitPrice");
b.Property<int>("Units");
b.HasKey("Id");
b.HasIndex("OrderId");
b.ToTable("OrderItems");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.Basket", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("BuyerId");
b.HasKey("Id");
b.ToTable("Baskets");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketItem", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("BasketId");
b.Property<int>("CatalogItemId");
b.Property<int>("Quantity");
b.Property<decimal>("UnitPrice");
b.HasKey("Id");
b.HasIndex("BasketId");
b.ToTable("BasketItem");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogBrand", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_brand_hilo")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
b.Property<string>("Brand")
.IsRequired()
.HasMaxLength(100);
b.HasKey("Id");
b.ToTable("CatalogBrand");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogItem", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_hilo")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
b.Property<int>("CatalogBrandId");
b.Property<int>("CatalogTypeId");
b.Property<string>("Description");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50);
b.Property<string>("PictureUri");
b.Property<decimal>("Price");
b.HasKey("Id");
b.HasIndex("CatalogBrandId");
b.HasIndex("CatalogTypeId");
b.ToTable("Catalog");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_type_hilo")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(100);
b.HasKey("Id");
b.ToTable("CatalogType");
});
modelBuilder.Entity("ApplicationCore.Entities.OrderAggregate.Order", b =>
{
b.OwnsOne("ApplicationCore.Entities.OrderAggregate.Address", "ShipToAddress", b1 =>
{
b1.Property<int>("OrderId");
b1.Property<string>("City");
b1.Property<string>("Country");
b1.Property<string>("State");
b1.Property<string>("Street");
b1.Property<string>("ZipCode");
b1.ToTable("Orders");
b1.HasOne("ApplicationCore.Entities.OrderAggregate.Order")
.WithOne("ShipToAddress")
.HasForeignKey("ApplicationCore.Entities.OrderAggregate.Address", "OrderId")
.OnDelete(DeleteBehavior.Cascade);
});
});
modelBuilder.Entity("ApplicationCore.Entities.OrderAggregate.OrderItem", b =>
{
b.HasOne("ApplicationCore.Entities.OrderAggregate.Order")
.WithMany("OrderItems")
.HasForeignKey("OrderId");
b.OwnsOne("ApplicationCore.Entities.OrderAggregate.CatalogItemOrdered", "ItemOrdered", b1 =>
{
b1.Property<int>("OrderItemId");
b1.Property<int>("CatalogItemId");
b1.Property<string>("PictureUri");
b1.Property<string>("ProductName");
b1.ToTable("OrderItems");
b1.HasOne("ApplicationCore.Entities.OrderAggregate.OrderItem")
.WithOne("ItemOrdered")
.HasForeignKey("ApplicationCore.Entities.OrderAggregate.CatalogItemOrdered", "OrderItemId")
.OnDelete(DeleteBehavior.Cascade);
});
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketItem", b =>
{
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.Basket")
.WithMany("Items")
.HasForeignKey("BasketId");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogItem", b =>
{
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogBrand", "CatalogBrand")
.WithMany()
.HasForeignKey("CatalogBrandId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogType", "CatalogType")
.WithMany()
.HasForeignKey("CatalogTypeId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,242 +0,0 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
{
[DbContext(typeof(CatalogContext))]
[Migration("20180725190153_AddExtraConstraints")]
partial class AddExtraConstraints
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.1.1-rtm-30846")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("Relational:Sequence:.catalog_brand_hilo", "'catalog_brand_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("Relational:Sequence:.catalog_hilo", "'catalog_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("Relational:Sequence:.catalog_type_hilo", "'catalog_type_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.Basket", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("BuyerId");
b.HasKey("Id");
b.ToTable("Baskets");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.BasketItem", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int?>("BasketId");
b.Property<int>("CatalogItemId");
b.Property<int>("Quantity");
b.Property<decimal>("UnitPrice");
b.HasKey("Id");
b.HasIndex("BasketId");
b.ToTable("BasketItem");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogBrand", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_brand_hilo")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
b.Property<string>("Brand")
.IsRequired()
.HasMaxLength(100);
b.HasKey("Id");
b.ToTable("CatalogBrand");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogItem", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_hilo")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
b.Property<int>("CatalogBrandId");
b.Property<int>("CatalogTypeId");
b.Property<string>("Description");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50);
b.Property<string>("PictureUri");
b.Property<decimal>("Price");
b.HasKey("Id");
b.HasIndex("CatalogBrandId");
b.HasIndex("CatalogTypeId");
b.ToTable("Catalog");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_type_hilo")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(100);
b.HasKey("Id");
b.ToTable("CatalogType");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("BuyerId");
b.Property<DateTimeOffset>("OrderDate");
b.HasKey("Id");
b.ToTable("Orders");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.OrderItem", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int?>("OrderId");
b.Property<decimal>("UnitPrice");
b.Property<int>("Units");
b.HasKey("Id");
b.HasIndex("OrderId");
b.ToTable("OrderItems");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.BasketItem", b =>
{
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.Basket")
.WithMany("Items")
.HasForeignKey("BasketId");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogItem", b =>
{
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogBrand", "CatalogBrand")
.WithMany()
.HasForeignKey("CatalogBrandId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogType", "CatalogType")
.WithMany()
.HasForeignKey("CatalogTypeId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order", b =>
{
b.OwnsOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Address", "ShipToAddress", b1 =>
{
b1.Property<int?>("OrderId")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("City")
.IsRequired()
.HasMaxLength(100);
b1.Property<string>("Country")
.IsRequired()
.HasMaxLength(90);
b1.Property<string>("State")
.HasMaxLength(60);
b1.Property<string>("Street")
.IsRequired()
.HasMaxLength(180);
b1.Property<string>("ZipCode")
.IsRequired()
.HasMaxLength(18);
b1.ToTable("Orders");
b1.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order")
.WithOne("ShipToAddress")
.HasForeignKey("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Address", "OrderId")
.OnDelete(DeleteBehavior.Cascade);
});
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.OrderItem", b =>
{
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order")
.WithMany("OrderItems")
.HasForeignKey("OrderId");
b.OwnsOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.CatalogItemOrdered", "ItemOrdered", b1 =>
{
b1.Property<int?>("OrderItemId")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<int>("CatalogItemId");
b1.Property<string>("PictureUri");
b1.Property<string>("ProductName")
.IsRequired()
.HasMaxLength(50);
b1.ToTable("OrderItems");
b1.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.OrderItem")
.WithOne("ItemOrdered")
.HasForeignKey("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.CatalogItemOrdered", "OrderItemId")
.OnDelete(DeleteBehavior.Cascade);
});
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,104 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
{
public partial class AddExtraConstraints : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "ShipToAddress_ZipCode",
table: "Orders",
maxLength: 18,
nullable: false,
oldClrType: typeof(string),
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ShipToAddress_Street",
table: "Orders",
maxLength: 180,
nullable: false,
oldClrType: typeof(string),
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ShipToAddress_State",
table: "Orders",
maxLength: 60,
nullable: true,
oldClrType: typeof(string),
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ShipToAddress_Country",
table: "Orders",
maxLength: 90,
nullable: false,
oldClrType: typeof(string),
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ShipToAddress_City",
table: "Orders",
maxLength: 100,
nullable: false,
oldClrType: typeof(string),
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ItemOrdered_ProductName",
table: "OrderItems",
maxLength: 50,
nullable: false,
oldClrType: typeof(string),
oldNullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "ShipToAddress_ZipCode",
table: "Orders",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 18);
migrationBuilder.AlterColumn<string>(
name: "ShipToAddress_Street",
table: "Orders",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 180);
migrationBuilder.AlterColumn<string>(
name: "ShipToAddress_State",
table: "Orders",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 60,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ShipToAddress_Country",
table: "Orders",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 90);
migrationBuilder.AlterColumn<string>(
name: "ShipToAddress_City",
table: "Orders",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 100);
migrationBuilder.AlterColumn<string>(
name: "ItemOrdered_ProductName",
table: "OrderItems",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 50);
}
}
}

View File

@@ -1,251 +0,0 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Microsoft.eShopWeb.Infrastructure.Data;
namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
{
[DbContext(typeof(CatalogContext))]
[Migration("20190601014740_UpdatingDefaultDataTypes")]
partial class UpdatingDefaultDataTypes
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.2.3-servicing-35854")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("Relational:Sequence:.catalog_brand_hilo", "'catalog_brand_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("Relational:Sequence:.catalog_hilo", "'catalog_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("Relational:Sequence:.catalog_type_hilo", "'catalog_type_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.Basket", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("BuyerId");
b.HasKey("Id");
b.ToTable("Baskets");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.BasketItem", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int?>("BasketId");
b.Property<int>("CatalogItemId");
b.Property<int>("Quantity");
b.Property<decimal>("UnitPrice")
.HasColumnType("decimal(18,2)");
b.HasKey("Id");
b.HasIndex("BasketId");
b.ToTable("BasketItems");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogBrand", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_brand_hilo")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
b.Property<string>("Brand")
.IsRequired()
.HasMaxLength(100);
b.HasKey("Id");
b.ToTable("CatalogBrand");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogItem", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_hilo")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
b.Property<int>("CatalogBrandId");
b.Property<int>("CatalogTypeId");
b.Property<string>("Description");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50);
b.Property<string>("PictureUri");
b.Property<decimal>("Price")
.HasColumnType("decimal(18,2)");
b.HasKey("Id");
b.HasIndex("CatalogBrandId");
b.HasIndex("CatalogTypeId");
b.ToTable("Catalog");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_type_hilo")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(100);
b.HasKey("Id");
b.ToTable("CatalogType");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("BuyerId");
b.Property<DateTimeOffset>("OrderDate");
b.HasKey("Id");
b.ToTable("Orders");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.OrderItem", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int?>("OrderId");
b.Property<decimal>("UnitPrice")
.HasColumnType("decimal(18,2)");
b.Property<int>("Units");
b.HasKey("Id");
b.HasIndex("OrderId");
b.ToTable("OrderItems");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.BasketItem", b =>
{
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.Basket")
.WithMany("Items")
.HasForeignKey("BasketId");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogItem", b =>
{
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogBrand", "CatalogBrand")
.WithMany()
.HasForeignKey("CatalogBrandId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogType", "CatalogType")
.WithMany()
.HasForeignKey("CatalogTypeId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order", b =>
{
b.OwnsOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Address", "ShipToAddress", b1 =>
{
b1.Property<int>("OrderId")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("City")
.IsRequired()
.HasMaxLength(100);
b1.Property<string>("Country")
.IsRequired()
.HasMaxLength(90);
b1.Property<string>("State")
.HasMaxLength(60);
b1.Property<string>("Street")
.IsRequired()
.HasMaxLength(180);
b1.Property<string>("ZipCode")
.IsRequired()
.HasMaxLength(18);
b1.HasKey("OrderId");
b1.ToTable("Orders");
b1.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order")
.WithOne("ShipToAddress")
.HasForeignKey("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Address", "OrderId")
.OnDelete(DeleteBehavior.Cascade);
});
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.OrderItem", b =>
{
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order")
.WithMany("OrderItems")
.HasForeignKey("OrderId");
b.OwnsOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.CatalogItemOrdered", "ItemOrdered", b1 =>
{
b1.Property<int>("OrderItemId")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<int>("CatalogItemId");
b1.Property<string>("PictureUri");
b1.Property<string>("ProductName")
.IsRequired()
.HasMaxLength(50);
b1.HasKey("OrderItemId");
b1.ToTable("OrderItems");
b1.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.OrderItem")
.WithOne("ItemOrdered")
.HasForeignKey("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.CatalogItemOrdered", "OrderItemId")
.OnDelete(DeleteBehavior.Cascade);
});
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,73 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
{
public partial class UpdatingDefaultDataTypes : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_BasketItem_Baskets_BasketId",
table: "BasketItem");
migrationBuilder.DropPrimaryKey(
name: "PK_BasketItem",
table: "BasketItem");
migrationBuilder.RenameTable(
name: "BasketItem",
newName: "BasketItems");
migrationBuilder.RenameIndex(
name: "IX_BasketItem_BasketId",
table: "BasketItems",
newName: "IX_BasketItems_BasketId");
migrationBuilder.AddPrimaryKey(
name: "PK_BasketItems",
table: "BasketItems",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_BasketItems_Baskets_BasketId",
table: "BasketItems",
column: "BasketId",
principalTable: "Baskets",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_BasketItems_Baskets_BasketId",
table: "BasketItems");
migrationBuilder.DropPrimaryKey(
name: "PK_BasketItems",
table: "BasketItems");
migrationBuilder.RenameTable(
name: "BasketItems",
newName: "BasketItem");
migrationBuilder.RenameIndex(
name: "IX_BasketItems_BasketId",
table: "BasketItem",
newName: "IX_BasketItem_BasketId");
migrationBuilder.AddPrimaryKey(
name: "PK_BasketItem",
table: "BasketItem",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_BasketItem_Baskets_BasketId",
table: "BasketItem",
column: "BasketId",
principalTable: "Baskets",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}

View File

@@ -1,254 +0,0 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Microsoft.eShopWeb.Infrastructure.Data;
namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
{
[DbContext(typeof(CatalogContext))]
[Migration("20190818191507_UpdatedConstraints")]
partial class UpdatedConstraints
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("Relational:Sequence:.catalog_brand_hilo", "'catalog_brand_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("Relational:Sequence:.catalog_hilo", "'catalog_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("Relational:Sequence:.catalog_type_hilo", "'catalog_type_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.Basket", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("BuyerId")
.IsRequired()
.HasMaxLength(20);
b.HasKey("Id");
b.ToTable("Baskets");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.BasketItem", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("BasketId");
b.Property<int>("CatalogItemId");
b.Property<int>("Quantity");
b.Property<decimal>("UnitPrice")
.HasColumnType("decimal(18,2)");
b.HasKey("Id");
b.HasIndex("BasketId");
b.ToTable("BasketItems");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogBrand", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_brand_hilo")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
b.Property<string>("Brand")
.IsRequired()
.HasMaxLength(100);
b.HasKey("Id");
b.ToTable("CatalogBrands");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogItem", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_hilo")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
b.Property<int>("CatalogBrandId");
b.Property<int>("CatalogTypeId");
b.Property<string>("Description");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50);
b.Property<string>("PictureUri");
b.Property<decimal>("Price")
.HasColumnType("decimal(18,2)");
b.HasKey("Id");
b.HasIndex("CatalogBrandId");
b.HasIndex("CatalogTypeId");
b.ToTable("Catalog");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_type_hilo")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(100);
b.HasKey("Id");
b.ToTable("CatalogTypes");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("BuyerId");
b.Property<DateTimeOffset>("OrderDate");
b.HasKey("Id");
b.ToTable("Orders");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.OrderItem", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int?>("OrderId");
b.Property<decimal>("UnitPrice")
.HasColumnType("decimal(18,2)");
b.Property<int>("Units");
b.HasKey("Id");
b.HasIndex("OrderId");
b.ToTable("OrderItems");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.BasketItem", b =>
{
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.Basket")
.WithMany("Items")
.HasForeignKey("BasketId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogItem", b =>
{
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogBrand", "CatalogBrand")
.WithMany()
.HasForeignKey("CatalogBrandId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogType", "CatalogType")
.WithMany()
.HasForeignKey("CatalogTypeId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order", b =>
{
b.OwnsOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Address", "ShipToAddress", b1 =>
{
b1.Property<int>("OrderId")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("City")
.IsRequired()
.HasMaxLength(100);
b1.Property<string>("Country")
.IsRequired()
.HasMaxLength(90);
b1.Property<string>("State")
.HasMaxLength(60);
b1.Property<string>("Street")
.IsRequired()
.HasMaxLength(180);
b1.Property<string>("ZipCode")
.IsRequired()
.HasMaxLength(18);
b1.HasKey("OrderId");
b1.ToTable("Orders");
b1.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order")
.WithOne("ShipToAddress")
.HasForeignKey("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Address", "OrderId")
.OnDelete(DeleteBehavior.Cascade);
});
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.OrderItem", b =>
{
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order")
.WithMany("OrderItems")
.HasForeignKey("OrderId");
b.OwnsOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.CatalogItemOrdered", "ItemOrdered", b1 =>
{
b1.Property<int>("OrderItemId")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<int>("CatalogItemId");
b1.Property<string>("PictureUri");
b1.Property<string>("ProductName")
.IsRequired()
.HasMaxLength(50);
b1.HasKey("OrderItemId");
b1.ToTable("OrderItems");
b1.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.OrderItem")
.WithOne("ItemOrdered")
.HasForeignKey("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.CatalogItemOrdered", "OrderItemId")
.OnDelete(DeleteBehavior.Cascade);
});
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,113 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
{
public partial class UpdatedConstraints : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Catalog_CatalogBrand_CatalogBrandId",
table: "Catalog");
migrationBuilder.DropForeignKey(
name: "FK_Catalog_CatalogType_CatalogTypeId",
table: "Catalog");
migrationBuilder.DropPrimaryKey(
name: "PK_CatalogType",
table: "CatalogType");
migrationBuilder.DropPrimaryKey(
name: "PK_CatalogBrand",
table: "CatalogBrand");
migrationBuilder.RenameTable(
name: "CatalogType",
newName: "CatalogTypes");
migrationBuilder.RenameTable(
name: "CatalogBrand",
newName: "CatalogBrands");
migrationBuilder.AddPrimaryKey(
name: "PK_CatalogTypes",
table: "CatalogTypes",
column: "Id");
migrationBuilder.AddPrimaryKey(
name: "PK_CatalogBrands",
table: "CatalogBrands",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Catalog_CatalogBrands_CatalogBrandId",
table: "Catalog",
column: "CatalogBrandId",
principalTable: "CatalogBrands",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Catalog_CatalogTypes_CatalogTypeId",
table: "Catalog",
column: "CatalogTypeId",
principalTable: "CatalogTypes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Catalog_CatalogBrands_CatalogBrandId",
table: "Catalog");
migrationBuilder.DropForeignKey(
name: "FK_Catalog_CatalogTypes_CatalogTypeId",
table: "Catalog");
migrationBuilder.DropPrimaryKey(
name: "PK_CatalogTypes",
table: "CatalogTypes");
migrationBuilder.DropPrimaryKey(
name: "PK_CatalogBrands",
table: "CatalogBrands");
migrationBuilder.RenameTable(
name: "CatalogTypes",
newName: "CatalogType");
migrationBuilder.RenameTable(
name: "CatalogBrands",
newName: "CatalogBrand");
migrationBuilder.AddPrimaryKey(
name: "PK_CatalogType",
table: "CatalogType",
column: "Id");
migrationBuilder.AddPrimaryKey(
name: "PK_CatalogBrand",
table: "CatalogBrand",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Catalog_CatalogBrand_CatalogBrandId",
table: "Catalog",
column: "CatalogBrandId",
principalTable: "CatalogBrand",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Catalog_CatalogType_CatalogTypeId",
table: "Catalog",
column: "CatalogTypeId",
principalTable: "CatalogType",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@@ -1,252 +0,0 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Microsoft.eShopWeb.Infrastructure.Data;
namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
{
[DbContext(typeof(CatalogContext))]
[Migration("20190911011026_UpdateCatalogModels")]
partial class UpdateCatalogModels
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("Relational:Sequence:.catalog_brand_hilo", "'catalog_brand_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("Relational:Sequence:.catalog_hilo", "'catalog_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("Relational:Sequence:.catalog_type_hilo", "'catalog_type_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.Basket", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("BuyerId");
b.HasKey("Id");
b.ToTable("Baskets");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.BasketItem", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("BasketId");
b.Property<int>("CatalogItemId");
b.Property<int>("Quantity");
b.Property<decimal>("UnitPrice")
.HasColumnType("decimal(18,2)");
b.HasKey("Id");
b.HasIndex("BasketId");
b.ToTable("BasketItems");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogBrand", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_brand_hilo")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
b.Property<string>("Brand")
.IsRequired()
.HasMaxLength(100);
b.HasKey("Id");
b.ToTable("CatalogBrand");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogItem", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_hilo")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
b.Property<int>("CatalogBrandId");
b.Property<int>("CatalogTypeId");
b.Property<string>("Description");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50);
b.Property<string>("PictureUri");
b.Property<decimal>("Price")
.HasColumnType("decimal(18,2)");
b.HasKey("Id");
b.HasIndex("CatalogBrandId");
b.HasIndex("CatalogTypeId");
b.ToTable("Catalog");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_type_hilo")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(100);
b.HasKey("Id");
b.ToTable("CatalogType");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("BuyerId");
b.Property<DateTimeOffset>("OrderDate");
b.HasKey("Id");
b.ToTable("Orders");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.OrderItem", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int?>("OrderId");
b.Property<decimal>("UnitPrice")
.HasColumnType("decimal(18,2)");
b.Property<int>("Units");
b.HasKey("Id");
b.HasIndex("OrderId");
b.ToTable("OrderItems");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.BasketItem", b =>
{
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.Basket")
.WithMany("Items")
.HasForeignKey("BasketId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogItem", b =>
{
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogBrand", "CatalogBrand")
.WithMany()
.HasForeignKey("CatalogBrandId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogType", "CatalogType")
.WithMany()
.HasForeignKey("CatalogTypeId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order", b =>
{
b.OwnsOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Address", "ShipToAddress", b1 =>
{
b1.Property<int>("OrderId")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("City")
.IsRequired()
.HasMaxLength(100);
b1.Property<string>("Country")
.IsRequired()
.HasMaxLength(90);
b1.Property<string>("State")
.HasMaxLength(60);
b1.Property<string>("Street")
.IsRequired()
.HasMaxLength(180);
b1.Property<string>("ZipCode")
.IsRequired()
.HasMaxLength(18);
b1.HasKey("OrderId");
b1.ToTable("Orders");
b1.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order")
.WithOne("ShipToAddress")
.HasForeignKey("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Address", "OrderId")
.OnDelete(DeleteBehavior.Cascade);
});
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.OrderItem", b =>
{
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order")
.WithMany("OrderItems")
.HasForeignKey("OrderId");
b.OwnsOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.CatalogItemOrdered", "ItemOrdered", b1 =>
{
b1.Property<int>("OrderItemId")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<int>("CatalogItemId");
b1.Property<string>("PictureUri");
b1.Property<string>("ProductName")
.IsRequired()
.HasMaxLength(50);
b1.HasKey("OrderItemId");
b1.ToTable("OrderItems");
b1.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.OrderItem")
.WithOne("ItemOrdered")
.HasForeignKey("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.CatalogItemOrdered", "OrderItemId")
.OnDelete(DeleteBehavior.Cascade);
});
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,128 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
{
public partial class UpdateCatalogModels : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Catalog_CatalogBrands_CatalogBrandId",
table: "Catalog");
migrationBuilder.DropForeignKey(
name: "FK_Catalog_CatalogTypes_CatalogTypeId",
table: "Catalog");
migrationBuilder.DropPrimaryKey(
name: "PK_CatalogTypes",
table: "CatalogTypes");
migrationBuilder.DropPrimaryKey(
name: "PK_CatalogBrands",
table: "CatalogBrands");
migrationBuilder.RenameTable(
name: "CatalogTypes",
newName: "CatalogType");
migrationBuilder.RenameTable(
name: "CatalogBrands",
newName: "CatalogBrand");
migrationBuilder.AlterColumn<string>(
name: "BuyerId",
table: "Baskets",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 20);
migrationBuilder.AddPrimaryKey(
name: "PK_CatalogType",
table: "CatalogType",
column: "Id");
migrationBuilder.AddPrimaryKey(
name: "PK_CatalogBrand",
table: "CatalogBrand",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Catalog_CatalogBrand_CatalogBrandId",
table: "Catalog",
column: "CatalogBrandId",
principalTable: "CatalogBrand",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Catalog_CatalogType_CatalogTypeId",
table: "Catalog",
column: "CatalogTypeId",
principalTable: "CatalogType",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Catalog_CatalogBrand_CatalogBrandId",
table: "Catalog");
migrationBuilder.DropForeignKey(
name: "FK_Catalog_CatalogType_CatalogTypeId",
table: "Catalog");
migrationBuilder.DropPrimaryKey(
name: "PK_CatalogType",
table: "CatalogType");
migrationBuilder.DropPrimaryKey(
name: "PK_CatalogBrand",
table: "CatalogBrand");
migrationBuilder.RenameTable(
name: "CatalogType",
newName: "CatalogTypes");
migrationBuilder.RenameTable(
name: "CatalogBrand",
newName: "CatalogBrands");
migrationBuilder.AlterColumn<string>(
name: "BuyerId",
table: "Baskets",
maxLength: 20,
nullable: false,
oldClrType: typeof(string),
oldNullable: true);
migrationBuilder.AddPrimaryKey(
name: "PK_CatalogTypes",
table: "CatalogTypes",
column: "Id");
migrationBuilder.AddPrimaryKey(
name: "PK_CatalogBrands",
table: "CatalogBrands",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Catalog_CatalogBrands_CatalogBrandId",
table: "Catalog",
column: "CatalogBrandId",
principalTable: "CatalogBrands",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Catalog_CatalogTypes_CatalogTypeId",
table: "Catalog",
column: "CatalogTypeId",
principalTable: "CatalogTypes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@@ -1,224 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
{
public partial class Post30Upgrade : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Catalog_CatalogBrand_CatalogBrandId",
table: "Catalog");
migrationBuilder.DropForeignKey(
name: "FK_Catalog_CatalogType_CatalogTypeId",
table: "Catalog");
migrationBuilder.DropPrimaryKey(
name: "PK_CatalogType",
table: "CatalogType");
migrationBuilder.DropPrimaryKey(
name: "PK_CatalogBrand",
table: "CatalogBrand");
migrationBuilder.RenameTable(
name: "CatalogType",
newName: "CatalogTypes");
migrationBuilder.RenameTable(
name: "CatalogBrand",
newName: "CatalogBrands");
migrationBuilder.AlterColumn<string>(
name: "ShipToAddress_ZipCode",
table: "Orders",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 18,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ShipToAddress_Street",
table: "Orders",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 180,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ShipToAddress_State",
table: "Orders",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 60,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ShipToAddress_Country",
table: "Orders",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 90,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ShipToAddress_City",
table: "Orders",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 100,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ItemOrdered_ProductName",
table: "OrderItems",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 50,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "BuyerId",
table: "Baskets",
maxLength: 40,
nullable: false,
oldClrType: typeof(string),
oldNullable: true);
migrationBuilder.AddPrimaryKey(
name: "PK_CatalogTypes",
table: "CatalogTypes",
column: "Id");
migrationBuilder.AddPrimaryKey(
name: "PK_CatalogBrands",
table: "CatalogBrands",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Catalog_CatalogBrands_CatalogBrandId",
table: "Catalog",
column: "CatalogBrandId",
principalTable: "CatalogBrands",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Catalog_CatalogTypes_CatalogTypeId",
table: "Catalog",
column: "CatalogTypeId",
principalTable: "CatalogTypes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Catalog_CatalogBrands_CatalogBrandId",
table: "Catalog");
migrationBuilder.DropForeignKey(
name: "FK_Catalog_CatalogTypes_CatalogTypeId",
table: "Catalog");
migrationBuilder.DropPrimaryKey(
name: "PK_CatalogTypes",
table: "CatalogTypes");
migrationBuilder.DropPrimaryKey(
name: "PK_CatalogBrands",
table: "CatalogBrands");
migrationBuilder.RenameTable(
name: "CatalogTypes",
newName: "CatalogType");
migrationBuilder.RenameTable(
name: "CatalogBrands",
newName: "CatalogBrand");
migrationBuilder.AlterColumn<string>(
name: "ShipToAddress_ZipCode",
table: "Orders",
maxLength: 18,
nullable: true,
oldClrType: typeof(string),
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ShipToAddress_Street",
table: "Orders",
maxLength: 180,
nullable: true,
oldClrType: typeof(string),
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ShipToAddress_State",
table: "Orders",
maxLength: 60,
nullable: true,
oldClrType: typeof(string),
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ShipToAddress_Country",
table: "Orders",
maxLength: 90,
nullable: true,
oldClrType: typeof(string),
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ShipToAddress_City",
table: "Orders",
maxLength: 100,
nullable: true,
oldClrType: typeof(string),
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ItemOrdered_ProductName",
table: "OrderItems",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "BuyerId",
table: "Baskets",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 40);
migrationBuilder.AddPrimaryKey(
name: "PK_CatalogType",
table: "CatalogType",
column: "Id");
migrationBuilder.AddPrimaryKey(
name: "PK_CatalogBrand",
table: "CatalogBrand",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Catalog_CatalogBrand_CatalogBrandId",
table: "Catalog",
column: "CatalogBrandId",
principalTable: "CatalogBrand",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Catalog_CatalogType_CatalogTypeId",
table: "Catalog",
column: "CatalogTypeId",
principalTable: "CatalogType",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@@ -1,285 +0,0 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Microsoft.eShopWeb.Infrastructure.Data;
namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
{
[DbContext(typeof(CatalogContext))]
[Migration("20191105161820_AddressAndCatalogItemOrderedChanges")]
partial class AddressAndCatalogItemOrderedChanges
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("Relational:Sequence:.catalog_brand_hilo", "'catalog_brand_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("Relational:Sequence:.catalog_hilo", "'catalog_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("Relational:Sequence:.catalog_type_hilo", "'catalog_type_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.Basket", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("BuyerId")
.IsRequired()
.HasColumnType("nvarchar(40)")
.HasMaxLength(40);
b.HasKey("Id");
b.ToTable("Baskets");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.BasketItem", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("BasketId")
.HasColumnType("int");
b.Property<int>("CatalogItemId")
.HasColumnType("int");
b.Property<int>("Quantity")
.HasColumnType("int");
b.Property<decimal>("UnitPrice")
.HasColumnType("decimal(18,2)");
b.HasKey("Id");
b.HasIndex("BasketId");
b.ToTable("BasketItems");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogBrand", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_brand_hilo")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
b.Property<string>("Brand")
.IsRequired()
.HasColumnType("nvarchar(100)")
.HasMaxLength(100);
b.HasKey("Id");
b.ToTable("CatalogBrands");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogItem", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_hilo")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
b.Property<int>("CatalogBrandId")
.HasColumnType("int");
b.Property<int>("CatalogTypeId")
.HasColumnType("int");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(50)")
.HasMaxLength(50);
b.Property<string>("PictureUri")
.HasColumnType("nvarchar(max)");
b.Property<decimal>("Price")
.HasColumnType("decimal(18,2)");
b.HasKey("Id");
b.HasIndex("CatalogBrandId");
b.HasIndex("CatalogTypeId");
b.ToTable("Catalog");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_type_hilo")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
b.Property<string>("Type")
.IsRequired()
.HasColumnType("nvarchar(100)")
.HasMaxLength(100);
b.HasKey("Id");
b.ToTable("CatalogTypes");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("BuyerId")
.HasColumnType("nvarchar(max)");
b.Property<DateTimeOffset>("OrderDate")
.HasColumnType("datetimeoffset");
b.HasKey("Id");
b.ToTable("Orders");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.OrderItem", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int?>("OrderId")
.HasColumnType("int");
b.Property<decimal>("UnitPrice")
.HasColumnType("decimal(18,2)");
b.Property<int>("Units")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("OrderId");
b.ToTable("OrderItems");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.BasketItem", b =>
{
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.Basket", null)
.WithMany("Items")
.HasForeignKey("BasketId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogItem", b =>
{
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogBrand", "CatalogBrand")
.WithMany()
.HasForeignKey("CatalogBrandId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogType", "CatalogType")
.WithMany()
.HasForeignKey("CatalogTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order", b =>
{
b.OwnsOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Address", "ShipToAddress", b1 =>
{
b1.Property<int>("OrderId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("City")
.IsRequired()
.HasColumnType("nvarchar(100)")
.HasMaxLength(100);
b1.Property<string>("Country")
.IsRequired()
.HasColumnType("nvarchar(90)")
.HasMaxLength(90);
b1.Property<string>("State")
.HasColumnType("nvarchar(60)")
.HasMaxLength(60);
b1.Property<string>("Street")
.IsRequired()
.HasColumnType("nvarchar(180)")
.HasMaxLength(180);
b1.Property<string>("ZipCode")
.IsRequired()
.HasColumnType("nvarchar(18)")
.HasMaxLength(18);
b1.HasKey("OrderId");
b1.ToTable("Orders");
b1.WithOwner()
.HasForeignKey("OrderId");
});
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.OrderItem", b =>
{
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order", null)
.WithMany("OrderItems")
.HasForeignKey("OrderId");
b.OwnsOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.CatalogItemOrdered", "ItemOrdered", b1 =>
{
b1.Property<int>("OrderItemId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<int>("CatalogItemId")
.HasColumnType("int");
b1.Property<string>("PictureUri")
.HasColumnType("nvarchar(max)");
b1.Property<string>("ProductName")
.IsRequired()
.HasColumnType("nvarchar(50)")
.HasMaxLength(50);
b1.HasKey("OrderItemId");
b1.ToTable("OrderItems");
b1.WithOwner()
.HasForeignKey("OrderItemId");
});
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,121 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
{
public partial class AddressAndCatalogItemOrderedChanges : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "ShipToAddress_ZipCode",
table: "Orders",
maxLength: 18,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ShipToAddress_Street",
table: "Orders",
maxLength: 180,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ShipToAddress_State",
table: "Orders",
maxLength: 60,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ShipToAddress_Country",
table: "Orders",
maxLength: 90,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ShipToAddress_City",
table: "Orders",
maxLength: 100,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ItemOrdered_ProductName",
table: "OrderItems",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "ShipToAddress_ZipCode",
table: "Orders",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 18,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ShipToAddress_Street",
table: "Orders",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 180,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ShipToAddress_State",
table: "Orders",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 60,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ShipToAddress_Country",
table: "Orders",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 90,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ShipToAddress_City",
table: "Orders",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 100,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ItemOrdered_ProductName",
table: "OrderItems",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 50,
oldNullable: true);
}
}
}

View File

@@ -10,31 +10,37 @@ using Microsoft.eShopWeb.Infrastructure.Data;
namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
{
[DbContext(typeof(CatalogContext))]
[Migration("20191031185508_Post30Upgrade")]
partial class Post30Upgrade
[Migration("20201202111507_InitialModel")]
partial class InitialModel
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.0.0")
.UseIdentityColumns()
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("Relational:Sequence:.catalog_brand_hilo", "'catalog_brand_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("Relational:Sequence:.catalog_hilo", "'catalog_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("Relational:Sequence:.catalog_type_hilo", "'catalog_type_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
.HasAnnotation("ProductVersion", "5.0.0");
modelBuilder.HasSequence("catalog_brand_hilo")
.IncrementsBy(10);
modelBuilder.HasSequence("catalog_hilo")
.IncrementsBy(10);
modelBuilder.HasSequence("catalog_type_hilo")
.IncrementsBy(10);
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.Basket", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
.UseIdentityColumn();
b.Property<string>("BuyerId")
.IsRequired()
.HasColumnType("nvarchar(40)")
.HasMaxLength(40);
.HasMaxLength(40)
.HasColumnType("nvarchar(40)");
b.HasKey("Id");
@@ -46,7 +52,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
.UseIdentityColumn();
b.Property<int>("BasketId")
.HasColumnType("int");
@@ -72,13 +78,12 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_brand_hilo")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
.UseHiLo("catalog_brand_hilo");
b.Property<string>("Brand")
.IsRequired()
.HasColumnType("nvarchar(100)")
.HasMaxLength(100);
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.HasKey("Id");
@@ -90,8 +95,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_hilo")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
.UseHiLo("catalog_hilo");
b.Property<int>("CatalogBrandId")
.HasColumnType("int");
@@ -104,8 +108,8 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(50)")
.HasMaxLength(50);
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("PictureUri")
.HasColumnType("nvarchar(max)");
@@ -127,13 +131,12 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_type_hilo")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
.UseHiLo("catalog_type_hilo");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("nvarchar(100)")
.HasMaxLength(100);
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.HasKey("Id");
@@ -145,7 +148,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
.UseIdentityColumn();
b.Property<string>("BuyerId")
.HasColumnType("nvarchar(max)");
@@ -163,7 +166,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
.UseIdentityColumn();
b.Property<int?>("OrderId")
.HasColumnType("int");
@@ -203,6 +206,10 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
.HasForeignKey("CatalogTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CatalogBrand");
b.Navigation("CatalogType");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order", b =>
@@ -212,22 +219,31 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
b1.Property<int>("OrderId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
.UseIdentityColumn();
b1.Property<string>("City")
.HasColumnType("nvarchar(max)");
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b1.Property<string>("Country")
.HasColumnType("nvarchar(max)");
.IsRequired()
.HasMaxLength(90)
.HasColumnType("nvarchar(90)");
b1.Property<string>("State")
.HasColumnType("nvarchar(max)");
.HasMaxLength(60)
.HasColumnType("nvarchar(60)");
b1.Property<string>("Street")
.HasColumnType("nvarchar(max)");
.IsRequired()
.HasMaxLength(180)
.HasColumnType("nvarchar(180)");
b1.Property<string>("ZipCode")
.HasColumnType("nvarchar(max)");
.IsRequired()
.HasMaxLength(18)
.HasColumnType("nvarchar(18)");
b1.HasKey("OrderId");
@@ -236,6 +252,8 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
b1.WithOwner()
.HasForeignKey("OrderId");
});
b.Navigation("ShipToAddress");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.OrderItem", b =>
@@ -249,7 +267,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
b1.Property<int>("OrderItemId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
.UseIdentityColumn();
b1.Property<int>("CatalogItemId")
.HasColumnType("int");
@@ -258,7 +276,9 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
.HasColumnType("nvarchar(max)");
b1.Property<string>("ProductName")
.HasColumnType("nvarchar(max)");
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b1.HasKey("OrderItemId");
@@ -267,6 +287,18 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
b1.WithOwner()
.HasForeignKey("OrderItemId");
});
b.Navigation("ItemOrdered");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.Basket", b =>
{
b.Navigation("Items");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order", b =>
{
b.Navigation("OrderItems");
});
#pragma warning restore 612, 618
}

View File

@@ -1,10 +1,9 @@
using Microsoft.EntityFrameworkCore.Metadata;
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
{
public partial class Initial : Migration
public partial class InitialModel : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
@@ -25,8 +24,8 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
BuyerId = table.Column<string>(type: "nvarchar(max)", nullable: true)
.Annotation("SqlServer:Identity", "1, 1"),
BuyerId = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false)
},
constraints: table =>
{
@@ -34,7 +33,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
});
migrationBuilder.CreateTable(
name: "CatalogBrand",
name: "CatalogBrands",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false),
@@ -42,11 +41,11 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
},
constraints: table =>
{
table.PrimaryKey("PK_CatalogBrand", x => x.Id);
table.PrimaryKey("PK_CatalogBrands", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CatalogType",
name: "CatalogTypes",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false),
@@ -54,7 +53,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
},
constraints: table =>
{
table.PrimaryKey("PK_CatalogType", x => x.Id);
table.PrimaryKey("PK_CatalogTypes", x => x.Id);
});
migrationBuilder.CreateTable(
@@ -62,14 +61,14 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
.Annotation("SqlServer:Identity", "1, 1"),
BuyerId = table.Column<string>(type: "nvarchar(max)", nullable: true),
OrderDate = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
ShipToAddress_City = table.Column<string>(type: "nvarchar(max)", nullable: true),
ShipToAddress_Country = table.Column<string>(type: "nvarchar(max)", nullable: true),
ShipToAddress_State = table.Column<string>(type: "nvarchar(max)", nullable: true),
ShipToAddress_Street = table.Column<string>(type: "nvarchar(max)", nullable: true),
ShipToAddress_ZipCode = table.Column<string>(type: "nvarchar(max)", nullable: true)
ShipToAddress_Street = table.Column<string>(type: "nvarchar(180)", maxLength: 180, nullable: true),
ShipToAddress_City = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
ShipToAddress_State = table.Column<string>(type: "nvarchar(60)", maxLength: 60, nullable: true),
ShipToAddress_Country = table.Column<string>(type: "nvarchar(90)", maxLength: 90, nullable: true),
ShipToAddress_ZipCode = table.Column<string>(type: "nvarchar(18)", maxLength: 18, nullable: true)
},
constraints: table =>
{
@@ -77,25 +76,25 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
});
migrationBuilder.CreateTable(
name: "BasketItem",
name: "BasketItems",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
BasketId = table.Column<int>(type: "int", nullable: true),
CatalogItemId = table.Column<int>(type: "int", nullable: false),
.Annotation("SqlServer:Identity", "1, 1"),
UnitPrice = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
Quantity = table.Column<int>(type: "int", nullable: false),
UnitPrice = table.Column<decimal>(type: "decimal(18, 2)", nullable: false)
CatalogItemId = table.Column<int>(type: "int", nullable: false),
BasketId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BasketItem", x => x.Id);
table.PrimaryKey("PK_BasketItems", x => x.Id);
table.ForeignKey(
name: "FK_BasketItem_Baskets_BasketId",
name: "FK_BasketItems_Baskets_BasketId",
column: x => x.BasketId,
principalTable: "Baskets",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
@@ -103,26 +102,26 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false),
CatalogBrandId = table.Column<int>(type: "int", nullable: false),
CatalogTypeId = table.Column<int>(type: "int", nullable: false),
Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
Price = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
PictureUri = table.Column<string>(type: "nvarchar(max)", nullable: true),
Price = table.Column<decimal>(type: "decimal(18, 2)", nullable: false)
CatalogTypeId = table.Column<int>(type: "int", nullable: false),
CatalogBrandId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Catalog", x => x.Id);
table.ForeignKey(
name: "FK_Catalog_CatalogBrand_CatalogBrandId",
name: "FK_Catalog_CatalogBrands_CatalogBrandId",
column: x => x.CatalogBrandId,
principalTable: "CatalogBrand",
principalTable: "CatalogBrands",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Catalog_CatalogType_CatalogTypeId",
name: "FK_Catalog_CatalogTypes_CatalogTypeId",
column: x => x.CatalogTypeId,
principalTable: "CatalogType",
principalTable: "CatalogTypes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
@@ -132,13 +131,13 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
OrderId = table.Column<int>(type: "int", nullable: true),
UnitPrice = table.Column<decimal>(type: "decimal(18, 2)", nullable: false),
Units = table.Column<int>(type: "int", nullable: false),
ItemOrdered_CatalogItemId = table.Column<int>(type: "int", nullable: false),
.Annotation("SqlServer:Identity", "1, 1"),
ItemOrdered_CatalogItemId = table.Column<int>(type: "int", nullable: true),
ItemOrdered_ProductName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
ItemOrdered_PictureUri = table.Column<string>(type: "nvarchar(max)", nullable: true),
ItemOrdered_ProductName = table.Column<string>(type: "nvarchar(max)", nullable: true)
UnitPrice = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
Units = table.Column<int>(type: "int", nullable: false),
OrderId = table.Column<int>(type: "int", nullable: true)
},
constraints: table =>
{
@@ -152,8 +151,8 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
});
migrationBuilder.CreateIndex(
name: "IX_BasketItem_BasketId",
table: "BasketItem",
name: "IX_BasketItems_BasketId",
table: "BasketItems",
column: "BasketId");
migrationBuilder.CreateIndex(
@@ -175,7 +174,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "BasketItem");
name: "BasketItems");
migrationBuilder.DropTable(
name: "Catalog");
@@ -187,10 +186,10 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
name: "Baskets");
migrationBuilder.DropTable(
name: "CatalogBrand");
name: "CatalogBrands");
migrationBuilder.DropTable(
name: "CatalogType");
name: "CatalogTypes");
migrationBuilder.DropTable(
name: "Orders");

View File

@@ -15,24 +15,30 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.0.0")
.UseIdentityColumns()
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("Relational:Sequence:.catalog_brand_hilo", "'catalog_brand_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("Relational:Sequence:.catalog_hilo", "'catalog_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("Relational:Sequence:.catalog_type_hilo", "'catalog_type_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
.HasAnnotation("ProductVersion", "5.0.0");
modelBuilder.HasSequence("catalog_brand_hilo")
.IncrementsBy(10);
modelBuilder.HasSequence("catalog_hilo")
.IncrementsBy(10);
modelBuilder.HasSequence("catalog_type_hilo")
.IncrementsBy(10);
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.Basket", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
.UseIdentityColumn();
b.Property<string>("BuyerId")
.IsRequired()
.HasColumnType("nvarchar(40)")
.HasMaxLength(40);
.HasMaxLength(40)
.HasColumnType("nvarchar(40)");
b.HasKey("Id");
@@ -44,7 +50,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
.UseIdentityColumn();
b.Property<int>("BasketId")
.HasColumnType("int");
@@ -70,13 +76,12 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_brand_hilo")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
.UseHiLo("catalog_brand_hilo");
b.Property<string>("Brand")
.IsRequired()
.HasColumnType("nvarchar(100)")
.HasMaxLength(100);
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.HasKey("Id");
@@ -88,8 +93,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_hilo")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
.UseHiLo("catalog_hilo");
b.Property<int>("CatalogBrandId")
.HasColumnType("int");
@@ -102,8 +106,8 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(50)")
.HasMaxLength(50);
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("PictureUri")
.HasColumnType("nvarchar(max)");
@@ -125,13 +129,12 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_type_hilo")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
.UseHiLo("catalog_type_hilo");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("nvarchar(100)")
.HasMaxLength(100);
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.HasKey("Id");
@@ -143,7 +146,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
.UseIdentityColumn();
b.Property<string>("BuyerId")
.HasColumnType("nvarchar(max)");
@@ -161,7 +164,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
.UseIdentityColumn();
b.Property<int?>("OrderId")
.HasColumnType("int");
@@ -201,6 +204,10 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
.HasForeignKey("CatalogTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CatalogBrand");
b.Navigation("CatalogType");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order", b =>
@@ -210,31 +217,31 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
b1.Property<int>("OrderId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
.UseIdentityColumn();
b1.Property<string>("City")
.IsRequired()
.HasColumnType("nvarchar(100)")
.HasMaxLength(100);
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b1.Property<string>("Country")
.IsRequired()
.HasColumnType("nvarchar(90)")
.HasMaxLength(90);
.HasMaxLength(90)
.HasColumnType("nvarchar(90)");
b1.Property<string>("State")
.HasColumnType("nvarchar(60)")
.HasMaxLength(60);
.HasMaxLength(60)
.HasColumnType("nvarchar(60)");
b1.Property<string>("Street")
.IsRequired()
.HasColumnType("nvarchar(180)")
.HasMaxLength(180);
.HasMaxLength(180)
.HasColumnType("nvarchar(180)");
b1.Property<string>("ZipCode")
.IsRequired()
.HasColumnType("nvarchar(18)")
.HasMaxLength(18);
.HasMaxLength(18)
.HasColumnType("nvarchar(18)");
b1.HasKey("OrderId");
@@ -243,6 +250,8 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
b1.WithOwner()
.HasForeignKey("OrderId");
});
b.Navigation("ShipToAddress");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.OrderItem", b =>
@@ -256,7 +265,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
b1.Property<int>("OrderItemId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
.UseIdentityColumn();
b1.Property<int>("CatalogItemId")
.HasColumnType("int");
@@ -266,8 +275,8 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
b1.Property<string>("ProductName")
.IsRequired()
.HasColumnType("nvarchar(50)")
.HasMaxLength(50);
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b1.HasKey("OrderItemId");
@@ -276,6 +285,18 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
b1.WithOwner()
.HasForeignKey("OrderItemId");
});
b.Navigation("ItemOrdered");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.Basket", b =>
{
b.Navigation("Items");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order", b =>
{
b.Navigation("OrderItems");
});
#pragma warning restore 612, 618
}

View File

@@ -1,215 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.eShopWeb.Infrastructure.Identity;
namespace Microsoft.eShopWeb.Infrastructure.Identity.Migrations
{
[DbContext(typeof(AppIdentityDbContext))]
[Migration("20170822214310_InitialIdentityModel")]
partial class InitialIdentityModel
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "1.1.2")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Infrastructure.Identity.ApplicationUser", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Email")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.HasMaxLength(256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasName("UserNameIndex");
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasMaxLength(256);
b.Property<string>("NormalizedName")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasName("RoleNameIndex");
b.ToTable("AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("LoginProvider");
b.Property<string>("Name");
b.Property<string>("Value");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole")
.WithMany("Claims")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim<string>", b =>
{
b.HasOne("Infrastructure.Identity.ApplicationUser")
.WithMany("Claims")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin<string>", b =>
{
b.HasOne("Infrastructure.Identity.ApplicationUser")
.WithMany("Logins")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole")
.WithMany("Users")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Infrastructure.Identity.ApplicationUser")
.WithMany("Roles")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
}
}
}

View File

@@ -0,0 +1,273 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Microsoft.eShopWeb.Infrastructure.Identity;
namespace Microsoft.eShopWeb.Infrastructure.Identity.Migrations
{
[DbContext(typeof(AppIdentityDbContext))]
[Migration("20201202111612_InitialIdentityModel")]
partial class InitialIdentityModel
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.UseIdentityColumns()
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.0");
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.UseIdentityColumn();
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.UseIdentityColumn();
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(450)");
b.Property<string>("ProviderKey")
.HasColumnType("nvarchar(450)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("RoleId")
.HasColumnType("nvarchar(450)");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(450)");
b.Property<string>("Name")
.HasColumnType("nvarchar(450)");
b.Property<string>("Value")
.HasColumnType("nvarchar(max)");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("Microsoft.eShopWeb.Infrastructure.Identity.ApplicationUser", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("bit");
b.Property<bool>("LockoutEnabled")
.HasColumnType("bit");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("nvarchar(max)");
b.Property<string>("PhoneNumber")
.HasColumnType("nvarchar(max)");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("bit");
b.Property<string>("SecurityStamp")
.HasColumnType("nvarchar(max)");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("bit");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex")
.HasFilter("[NormalizedUserName] IS NOT NULL");
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("Microsoft.eShopWeb.Infrastructure.Identity.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("Microsoft.eShopWeb.Infrastructure.Identity.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Microsoft.eShopWeb.Infrastructure.Identity.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("Microsoft.eShopWeb.Infrastructure.Identity.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,6 +1,5 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Metadata;
namespace Microsoft.eShopWeb.Infrastructure.Identity.Migrations
{
@@ -8,39 +7,14 @@ namespace Microsoft.eShopWeb.Infrastructure.Identity.Migrations
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AspNetUsers",
columns: table => new
{
Id = table.Column<string>(nullable: false),
AccessFailedCount = table.Column<int>(nullable: false),
ConcurrencyStamp = table.Column<string>(nullable: true),
Email = table.Column<string>(maxLength: 256, nullable: true),
EmailConfirmed = table.Column<bool>(nullable: false),
LockoutEnabled = table.Column<bool>(nullable: false),
LockoutEnd = table.Column<DateTimeOffset>(nullable: true),
NormalizedEmail = table.Column<string>(maxLength: 256, nullable: true),
NormalizedUserName = table.Column<string>(maxLength: 256, nullable: true),
PasswordHash = table.Column<string>(nullable: true),
PhoneNumber = table.Column<string>(nullable: true),
PhoneNumberConfirmed = table.Column<bool>(nullable: false),
SecurityStamp = table.Column<string>(nullable: true),
TwoFactorEnabled = table.Column<bool>(nullable: false),
UserName = table.Column<string>(maxLength: 256, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUsers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AspNetRoles",
columns: table => new
{
Id = table.Column<string>(nullable: false),
ConcurrencyStamp = table.Column<string>(nullable: true),
Name = table.Column<string>(maxLength: 256, nullable: true),
NormalizedName = table.Column<string>(maxLength: 256, nullable: true)
Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
Name = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
NormalizedName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
@@ -48,28 +22,60 @@ namespace Microsoft.eShopWeb.Infrastructure.Identity.Migrations
});
migrationBuilder.CreateTable(
name: "AspNetUserTokens",
name: "AspNetUsers",
columns: table => new
{
UserId = table.Column<string>(nullable: false),
LoginProvider = table.Column<string>(nullable: false),
Name = table.Column<string>(nullable: false),
Value = table.Column<string>(nullable: true)
Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
UserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
NormalizedUserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
Email = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
NormalizedEmail = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
EmailConfirmed = table.Column<bool>(type: "bit", nullable: false),
PasswordHash = table.Column<string>(type: "nvarchar(max)", nullable: true),
SecurityStamp = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true),
PhoneNumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
PhoneNumberConfirmed = table.Column<bool>(type: "bit", nullable: false),
TwoFactorEnabled = table.Column<bool>(type: "bit", nullable: false),
LockoutEnd = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
LockoutEnabled = table.Column<bool>(type: "bit", nullable: false),
AccessFailedCount = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
table.PrimaryKey("PK_AspNetUsers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AspNetRoleClaims",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false),
ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
table.ForeignKey(
name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
column: x => x.RoleId,
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserClaims",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClaimType = table.Column<string>(nullable: true),
ClaimValue = table.Column<string>(nullable: true),
UserId = table.Column<string>(nullable: false)
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
@@ -86,10 +92,10 @@ namespace Microsoft.eShopWeb.Infrastructure.Identity.Migrations
name: "AspNetUserLogins",
columns: table => new
{
LoginProvider = table.Column<string>(nullable: false),
ProviderKey = table.Column<string>(nullable: false),
ProviderDisplayName = table.Column<string>(nullable: true),
UserId = table.Column<string>(nullable: false)
LoginProvider = table.Column<string>(type: "nvarchar(450)", nullable: false),
ProviderKey = table.Column<string>(type: "nvarchar(450)", nullable: false),
ProviderDisplayName = table.Column<string>(type: "nvarchar(max)", nullable: true),
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false)
},
constraints: table =>
{
@@ -102,33 +108,12 @@ namespace Microsoft.eShopWeb.Infrastructure.Identity.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetRoleClaims",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ClaimType = table.Column<string>(nullable: true),
ClaimValue = table.Column<string>(nullable: true),
RoleId = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
table.ForeignKey(
name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
column: x => x.RoleId,
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserRoles",
columns: table => new
{
UserId = table.Column<string>(nullable: false),
RoleId = table.Column<string>(nullable: false)
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false)
},
constraints: table =>
{
@@ -147,28 +132,38 @@ namespace Microsoft.eShopWeb.Infrastructure.Identity.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "EmailIndex",
table: "AspNetUsers",
column: "NormalizedEmail");
migrationBuilder.CreateIndex(
name: "UserNameIndex",
table: "AspNetUsers",
column: "NormalizedUserName",
unique: true);
migrationBuilder.CreateIndex(
name: "RoleNameIndex",
table: "AspNetRoles",
column: "NormalizedName",
unique: true);
migrationBuilder.CreateTable(
name: "AspNetUserTokens",
columns: table => new
{
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
LoginProvider = table.Column<string>(type: "nvarchar(450)", nullable: false),
Name = table.Column<string>(type: "nvarchar(450)", nullable: false),
Value = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
table.ForeignKey(
name: "FK_AspNetUserTokens_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_AspNetRoleClaims_RoleId",
table: "AspNetRoleClaims",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "RoleNameIndex",
table: "AspNetRoles",
column: "NormalizedName",
unique: true,
filter: "[NormalizedName] IS NOT NULL");
migrationBuilder.CreateIndex(
name: "IX_AspNetUserClaims_UserId",
table: "AspNetUserClaims",
@@ -183,6 +178,18 @@ namespace Microsoft.eShopWeb.Infrastructure.Identity.Migrations
name: "IX_AspNetUserRoles_RoleId",
table: "AspNetUserRoles",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "EmailIndex",
table: "AspNetUsers",
column: "NormalizedEmail");
migrationBuilder.CreateIndex(
name: "UserNameIndex",
table: "AspNetUsers",
column: "NormalizedUserName",
unique: true,
filter: "[NormalizedUserName] IS NOT NULL");
}
protected override void Down(MigrationBuilder migrationBuilder)

View File

@@ -1,7 +1,10 @@
using System;
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Microsoft.eShopWeb.Infrastructure.Identity;
namespace Microsoft.eShopWeb.Infrastructure.Identity.Migrations
{
@@ -10,94 +13,55 @@ namespace Microsoft.eShopWeb.Infrastructure.Identity.Migrations
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "1.1.2")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
.UseIdentityColumns()
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.0");
modelBuilder.Entity("Infrastructure.Identity.ApplicationUser", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AccessFailedCount");
.HasColumnType("nvarchar(450)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Email")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.HasMaxLength(256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasName("UserNameIndex");
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.HasMaxLength(256);
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256);
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasName("RoleNameIndex");
.HasDatabaseName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
.ValueGeneratedOnAdd()
.HasColumnType("int")
.UseIdentityColumn();
b.Property<string>("ClaimType");
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("RoleId")
.IsRequired();
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
@@ -106,17 +70,22 @@ namespace Microsoft.eShopWeb.Infrastructure.Identity.Migrations
b.ToTable("AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
.ValueGeneratedOnAdd()
.HasColumnType("int")
.UseIdentityColumn();
b.Property<string>("ClaimType");
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired();
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
@@ -125,16 +94,20 @@ namespace Microsoft.eShopWeb.Infrastructure.Identity.Migrations
b.ToTable("AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(450)");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderKey")
.HasColumnType("nvarchar(450)");
b.Property<string>("ProviderDisplayName");
b.Property<string>("ProviderDisplayName")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired();
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("LoginProvider", "ProviderKey");
@@ -143,11 +116,13 @@ namespace Microsoft.eShopWeb.Infrastructure.Identity.Migrations
b.ToTable("AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("RoleId");
b.Property<string>("RoleId")
.HasColumnType("nvarchar(450)");
b.HasKey("UserId", "RoleId");
@@ -156,57 +131,141 @@ namespace Microsoft.eShopWeb.Infrastructure.Identity.Migrations
b.ToTable("AspNetUserRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserToken<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("LoginProvider");
b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(450)");
b.Property<string>("Name");
b.Property<string>("Name")
.HasColumnType("nvarchar(450)");
b.Property<string>("Value");
b.Property<string>("Value")
.HasColumnType("nvarchar(max)");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRoleClaim<string>", b =>
modelBuilder.Entity("Microsoft.eShopWeb.Infrastructure.Identity.ApplicationUser", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole")
.WithMany("Claims")
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("bit");
b.Property<bool>("LockoutEnabled")
.HasColumnType("bit");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("nvarchar(max)");
b.Property<string>("PhoneNumber")
.HasColumnType("nvarchar(max)");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("bit");
b.Property<string>("SecurityStamp")
.HasColumnType("nvarchar(max)");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("bit");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex")
.HasFilter("[NormalizedUserName] IS NOT NULL");
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("Infrastructure.Identity.ApplicationUser")
.WithMany("Claims")
b.HasOne("Microsoft.eShopWeb.Infrastructure.Identity.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("Infrastructure.Identity.ApplicationUser")
.WithMany("Logins")
b.HasOne("Microsoft.eShopWeb.Infrastructure.Identity.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserRole<string>", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole")
.WithMany("Users")
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Infrastructure.Identity.ApplicationUser")
.WithMany("Roles")
b.HasOne("Microsoft.eShopWeb.Infrastructure.Identity.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("Microsoft.eShopWeb.Infrastructure.Identity.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,19 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>Microsoft.eShopWeb.Infrastructure</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Ardalis.EFCore.Extensions" Version="1.1.0" />
<PackageReference Include="Ardalis.Specification" Version="4.0.0" />
<PackageReference Include="Ardalis.Specification.EntityFrameworkCore" Version="4.0.0" />
<PackageReference Include="Ardalis.Specification" Version="4.1.0" />
<PackageReference Include="Ardalis.Specification.EntityFrameworkCore" Version="4.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.5" PrivateAssets="All" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.7.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.0" PrivateAssets="All" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.8.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ApplicationCore\ApplicationCore.csproj" />