Add max length and required constraints
This commit is contained in:
@@ -28,6 +28,37 @@ namespace Microsoft.eShopWeb.Infrastructure.Data
|
||||
builder.Entity<CatalogItem>(ConfigureCatalogItem);
|
||||
builder.Entity<Order>(ConfigureOrder);
|
||||
builder.Entity<OrderItem>(ConfigureOrderItem);
|
||||
builder.Entity<Address>(ConfigureAddress);
|
||||
builder.Entity<CatalogItemOrdered>(ConfigurateCatalogItemOrdered);
|
||||
}
|
||||
|
||||
private void ConfigurateCatalogItemOrdered(EntityTypeBuilder<CatalogItemOrdered> builder)
|
||||
{
|
||||
builder.Property(cio => cio.ProductName)
|
||||
.HasMaxLength(50)
|
||||
.IsRequired();
|
||||
}
|
||||
|
||||
private void ConfigureAddress(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(189)
|
||||
.IsRequired();
|
||||
}
|
||||
|
||||
private void ConfigureBasket(EntityTypeBuilder<Basket> builder)
|
||||
|
||||
244
src/Infrastructure/Data/Migrations/20180725190153_AddExtraConstrains.Designer.cs
generated
Normal file
244
src/Infrastructure/Data/Migrations/20180725190153_AddExtraConstrains.Designer.cs
generated
Normal file
@@ -0,0 +1,244 @@
|
||||
// <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("20180725190153_AddExtraConstrains")]
|
||||
partial class AddExtraConstrains
|
||||
{
|
||||
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(189);
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
|
||||
{
|
||||
public partial class AddExtraConstrains : 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: 189,
|
||||
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: 189);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "ItemOrdered_ProductName",
|
||||
table: "OrderItems",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldMaxLength: 50);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,10 @@
|
||||
// <auto-generated />
|
||||
using Microsoft.eShopWeb.Infrastructure.Data;
|
||||
using System;
|
||||
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;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Microsoft.eShopWeb.Infrastructure.Data;
|
||||
|
||||
namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
|
||||
{
|
||||
@@ -17,48 +15,18 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "2.0.0-rtm-26452")
|
||||
.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("ApplicationCore.Entities.OrderAggregate.Order", b =>
|
||||
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.Basket", 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();
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("BuyerId");
|
||||
|
||||
@@ -67,10 +35,11 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
|
||||
b.ToTable("Baskets");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketItem", b =>
|
||||
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.BasketItem", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int?>("BasketId");
|
||||
|
||||
@@ -149,59 +118,43 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
|
||||
b.ToTable("CatalogType");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ApplicationCore.Entities.OrderAggregate.Order", b =>
|
||||
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order", b =>
|
||||
{
|
||||
b.OwnsOne("ApplicationCore.Entities.OrderAggregate.Address", "ShipToAddress", b1 =>
|
||||
{
|
||||
b1.Property<int>("OrderId");
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b1.Property<string>("City");
|
||||
b.Property<string>("BuyerId");
|
||||
|
||||
b1.Property<string>("Country");
|
||||
b.Property<DateTimeOffset>("OrderDate");
|
||||
|
||||
b1.Property<string>("State");
|
||||
b.HasKey("Id");
|
||||
|
||||
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);
|
||||
});
|
||||
b.ToTable("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ApplicationCore.Entities.OrderAggregate.OrderItem", b =>
|
||||
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.OrderItem", b =>
|
||||
{
|
||||
b.HasOne("ApplicationCore.Entities.OrderAggregate.Order")
|
||||
.WithMany("OrderItems")
|
||||
.HasForeignKey("OrderId");
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.OwnsOne("ApplicationCore.Entities.OrderAggregate.CatalogItemOrdered", "ItemOrdered", b1 =>
|
||||
{
|
||||
b1.Property<int>("OrderItemId");
|
||||
b.Property<int?>("OrderId");
|
||||
|
||||
b1.Property<int>("CatalogItemId");
|
||||
b.Property<decimal>("UnitPrice");
|
||||
|
||||
b1.Property<string>("PictureUri");
|
||||
b.Property<int>("Units");
|
||||
|
||||
b1.Property<string>("ProductName");
|
||||
b.HasKey("Id");
|
||||
|
||||
b1.ToTable("OrderItems");
|
||||
b.HasIndex("OrderId");
|
||||
|
||||
b1.HasOne("ApplicationCore.Entities.OrderAggregate.OrderItem")
|
||||
.WithOne("ItemOrdered")
|
||||
.HasForeignKey("ApplicationCore.Entities.OrderAggregate.CatalogItemOrdered", "OrderItemId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
b.ToTable("OrderItems");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketItem", b =>
|
||||
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.BasketItem", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.Basket")
|
||||
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.Basket")
|
||||
.WithMany("Items")
|
||||
.HasForeignKey("BasketId");
|
||||
});
|
||||
@@ -218,6 +171,71 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
|
||||
.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(189);
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user