//
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("Id")
.ValueGeneratedOnAdd();
b.Property("BuyerId");
b.Property("OrderDate");
b.HasKey("Id");
b.ToTable("Orders");
});
modelBuilder.Entity("ApplicationCore.Entities.OrderAggregate.OrderItem", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd();
b.Property("OrderId");
b.Property("UnitPrice");
b.Property("Units");
b.HasKey("Id");
b.HasIndex("OrderId");
b.ToTable("OrderItems");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.Basket", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd();
b.Property("BuyerId");
b.HasKey("Id");
b.ToTable("Baskets");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketItem", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd();
b.Property("BasketId");
b.Property("CatalogItemId");
b.Property("Quantity");
b.Property("UnitPrice");
b.HasKey("Id");
b.HasIndex("BasketId");
b.ToTable("BasketItem");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogBrand", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_brand_hilo")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
b.Property("Brand")
.IsRequired()
.HasMaxLength(100);
b.HasKey("Id");
b.ToTable("CatalogBrand");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogItem", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_hilo")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
b.Property("CatalogBrandId");
b.Property("CatalogTypeId");
b.Property("Description");
b.Property("Name")
.IsRequired()
.HasMaxLength(50);
b.Property("PictureUri");
b.Property("Price");
b.HasKey("Id");
b.HasIndex("CatalogBrandId");
b.HasIndex("CatalogTypeId");
b.ToTable("Catalog");
});
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogType", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_type_hilo")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
b.Property("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("OrderId");
b1.Property("City");
b1.Property("Country");
b1.Property("State");
b1.Property("Street");
b1.Property("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("OrderItemId");
b1.Property("CatalogItemId");
b1.Property("PictureUri");
b1.Property("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
}
}
}