Cleaning up EF 2.0 Migrations (#57)

Moving Seed logic to Program.cs
This commit is contained in:
Steve Smith
2017-10-18 14:25:10 -04:00
committed by GitHub
parent 8de663eab6
commit 32950aa175
9 changed files with 456 additions and 221 deletions

View File

@@ -1,9 +1,12 @@
using System;
// <auto-generated />
using Infrastructure.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Infrastructure.Data;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Storage.Internal;
using System;
namespace Infrastructure.Data.Migrations
{
@@ -12,13 +15,46 @@ namespace Infrastructure.Data.Migrations
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "1.1.2")
.HasAnnotation("SqlServer:Sequence:.catalog_brand_hilo", "'catalog_brand_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("SqlServer:Sequence:.catalog_hilo", "'catalog_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.HasAnnotation("SqlServer:Sequence:.catalog_type_hilo", "'catalog_type_hilo', '', '1', '10', '', '', 'Int64', 'False'")
.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")
@@ -113,6 +149,56 @@ namespace Infrastructure.Data.Migrations
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")
@@ -132,6 +218,7 @@ namespace Infrastructure.Data.Migrations
.HasForeignKey("CatalogTypeId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}