Browse Source
* Updates based on documentation * Getting the build passing * Getting app functioning * A few cleanups to confirm it's working as expected * Fixing functional tests * Updating dockerfile for 3.0 * Functional Tests now run sequentially * Updating to latest version of moq * Adding migration for post 3.0 upgrades * Removing commented out lines * Moving address and catalogitemordered configuration in to classes that own them * Minor cleanupsmain
committed by
Steve Smith
29 changed files with 1072 additions and 285 deletions
@ -1,31 +0,0 @@ |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Metadata.Builders; |
|||
using Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate; |
|||
|
|||
namespace Microsoft.eShopWeb.Infrastructure.Data.Config |
|||
{ |
|||
public class AddressConfiguration : IEntityTypeConfiguration<Address> |
|||
{ |
|||
public void Configure(EntityTypeBuilder<Address> builder) |
|||
{ |
|||
builder.Property(a => a.ZipCode) |
|||
.HasMaxLength(18) |
|||
.IsRequired(); |
|||
|
|||
builder.Property(a => a.Street) |
|||
.HasMaxLength(180) |
|||
.IsRequired(); |
|||
|
|||
builder.Property(a => a.State) |
|||
.HasMaxLength(60); |
|||
|
|||
builder.Property(a => a.Country) |
|||
.HasMaxLength(90) |
|||
.IsRequired(); |
|||
|
|||
builder.Property(a => a.City) |
|||
.HasMaxLength(100) |
|||
.IsRequired(); |
|||
} |
|||
} |
|||
} |
|||
@ -1,16 +0,0 @@ |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Metadata.Builders; |
|||
using Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate; |
|||
|
|||
namespace Microsoft.eShopWeb.Infrastructure.Data.Config |
|||
{ |
|||
public class CatalogItemOrderedConfiguration : IEntityTypeConfiguration<CatalogItemOrdered> |
|||
{ |
|||
public void Configure(EntityTypeBuilder<CatalogItemOrdered> builder) |
|||
{ |
|||
builder.Property(cio => cio.ProductName) |
|||
.HasMaxLength(50) |
|||
.IsRequired(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,274 @@ |
|||
// <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("20191031185508_Post30Upgrade")] |
|||
partial class Post30Upgrade |
|||
{ |
|||
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") |
|||
.HasColumnType("nvarchar(max)"); |
|||
|
|||
b1.Property<string>("Country") |
|||
.HasColumnType("nvarchar(max)"); |
|||
|
|||
b1.Property<string>("State") |
|||
.HasColumnType("nvarchar(max)"); |
|||
|
|||
b1.Property<string>("Street") |
|||
.HasColumnType("nvarchar(max)"); |
|||
|
|||
b1.Property<string>("ZipCode") |
|||
.HasColumnType("nvarchar(max)"); |
|||
|
|||
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") |
|||
.HasColumnType("nvarchar(max)"); |
|||
|
|||
b1.HasKey("OrderItemId"); |
|||
|
|||
b1.ToTable("OrderItems"); |
|||
|
|||
b1.WithOwner() |
|||
.HasForeignKey("OrderItemId"); |
|||
}); |
|||
}); |
|||
#pragma warning restore 612, 618
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,224 @@ |
|||
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); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,285 @@ |
|||
// <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
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,121 @@ |
|||
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); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue