Netcore3.0 (#323)
* 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 cleanups
This commit is contained in:
committed by
Steve Smith
parent
9a21db6979
commit
4442015835
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>netstandard2.1</TargetFramework>
|
||||||
<RootNamespace>Microsoft.eShopWeb.ApplicationCore</RootNamespace>
|
<RootNamespace>Microsoft.eShopWeb.ApplicationCore</RootNamespace>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
using Microsoft.eShopWeb.ApplicationCore.Entities;
|
using Microsoft.eShopWeb.ApplicationCore.Entities;
|
||||||
using Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate;
|
using Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate;
|
||||||
using Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate;
|
using Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
namespace Microsoft.eShopWeb.Infrastructure.Data
|
namespace Microsoft.eShopWeb.Infrastructure.Data
|
||||||
{
|
{
|
||||||
@@ -23,142 +23,8 @@ namespace Microsoft.eShopWeb.Infrastructure.Data
|
|||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder builder)
|
protected override void OnModelCreating(ModelBuilder builder)
|
||||||
{
|
{
|
||||||
//Intentionally rolling back this change to fix issue: https://github.com/dotnet-architecture/eShopOnWeb/issues/292
|
base.OnModelCreating(builder);
|
||||||
//Will follow up after issue has been resolved.
|
builder.ApplyConfigurationsFromAssembly(Assembly.GetExecutingAssembly());
|
||||||
//base.OnModelCreating(builder);
|
|
||||||
//builder.ApplyAllConfigurationsFromCurrentAssembly();
|
|
||||||
|
|
||||||
// alternately this is built-in to EF Core 2.2
|
|
||||||
//builder.ApplyConfigurationsFromAssembly(Assembly.GetExecutingAssembly());
|
|
||||||
|
|
||||||
builder.Entity<Basket>(ConfigureBasket);
|
|
||||||
builder.Entity<CatalogBrand>(ConfigureCatalogBrand);
|
|
||||||
builder.Entity<CatalogType>(ConfigureCatalogType);
|
|
||||||
builder.Entity<CatalogItem>(ConfigureCatalogItem);
|
|
||||||
builder.Entity<Order>(ConfigureOrder);
|
|
||||||
builder.Entity<OrderItem>(ConfigureOrderItem);
|
|
||||||
builder.Entity<Address>(ConfigureAddress);
|
|
||||||
builder.Entity<CatalogItemOrdered>(ConfigureCatalogItemOrdered);
|
|
||||||
builder.Entity<BasketItem>(ConfigureBasketItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ConfigureBasketItem(EntityTypeBuilder<BasketItem> builder)
|
|
||||||
{
|
|
||||||
builder.Property(bi => bi.UnitPrice)
|
|
||||||
.IsRequired(true)
|
|
||||||
.HasColumnType("decimal(18,2)");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ConfigureCatalogItemOrdered(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(100)
|
|
||||||
.IsRequired();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ConfigureBasket(EntityTypeBuilder<Basket> builder)
|
|
||||||
{
|
|
||||||
var navigation = builder.Metadata.FindNavigation(nameof(Basket.Items));
|
|
||||||
|
|
||||||
navigation.SetPropertyAccessMode(PropertyAccessMode.Field);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ConfigureCatalogItem(EntityTypeBuilder<CatalogItem> builder)
|
|
||||||
{
|
|
||||||
builder.ToTable("Catalog");
|
|
||||||
|
|
||||||
builder.Property(ci => ci.Id)
|
|
||||||
.ForSqlServerUseSequenceHiLo("catalog_hilo")
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(ci => ci.Name)
|
|
||||||
.IsRequired(true)
|
|
||||||
.HasMaxLength(50);
|
|
||||||
|
|
||||||
builder.Property(ci => ci.Price)
|
|
||||||
.IsRequired(true)
|
|
||||||
.HasColumnType("decimal(18,2)");
|
|
||||||
|
|
||||||
builder.Property(ci => ci.PictureUri)
|
|
||||||
.IsRequired(false);
|
|
||||||
|
|
||||||
builder.HasOne(ci => ci.CatalogBrand)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey(ci => ci.CatalogBrandId);
|
|
||||||
|
|
||||||
builder.HasOne(ci => ci.CatalogType)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey(ci => ci.CatalogTypeId);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ConfigureCatalogBrand(EntityTypeBuilder<CatalogBrand> builder)
|
|
||||||
{
|
|
||||||
builder.ToTable("CatalogBrand");
|
|
||||||
|
|
||||||
builder.HasKey(ci => ci.Id);
|
|
||||||
|
|
||||||
builder.Property(ci => ci.Id)
|
|
||||||
.ForSqlServerUseSequenceHiLo("catalog_brand_hilo")
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(cb => cb.Brand)
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ConfigureCatalogType(EntityTypeBuilder<CatalogType> builder)
|
|
||||||
{
|
|
||||||
builder.ToTable("CatalogType");
|
|
||||||
|
|
||||||
builder.HasKey(ci => ci.Id);
|
|
||||||
|
|
||||||
builder.Property(ci => ci.Id)
|
|
||||||
.ForSqlServerUseSequenceHiLo("catalog_type_hilo")
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(cb => cb.Type)
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ConfigureOrder(EntityTypeBuilder<Order> builder)
|
|
||||||
{
|
|
||||||
var navigation = builder.Metadata.FindNavigation(nameof(Order.OrderItems));
|
|
||||||
|
|
||||||
navigation.SetPropertyAccessMode(PropertyAccessMode.Field);
|
|
||||||
|
|
||||||
builder.OwnsOne(o => o.ShipToAddress);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ConfigureOrderItem(EntityTypeBuilder<OrderItem> builder)
|
|
||||||
{
|
|
||||||
builder.OwnsOne(i => i.ItemOrdered);
|
|
||||||
|
|
||||||
builder.Property(oi => oi.UnitPrice)
|
|
||||||
.IsRequired(true)
|
|
||||||
.HasColumnType("decimal(18,2)");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -13,7 +13,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Config
|
|||||||
|
|
||||||
builder.Property(b => b.BuyerId)
|
builder.Property(b => b.BuyerId)
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(20);
|
.HasMaxLength(40);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Config
|
|||||||
builder.HasKey(ci => ci.Id);
|
builder.HasKey(ci => ci.Id);
|
||||||
|
|
||||||
builder.Property(ci => ci.Id)
|
builder.Property(ci => ci.Id)
|
||||||
.ForSqlServerUseSequenceHiLo("catalog_brand_hilo")
|
.UseHiLo("catalog_brand_hilo")
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
builder.Property(cb => cb.Brand)
|
builder.Property(cb => cb.Brand)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Config
|
|||||||
builder.ToTable("Catalog");
|
builder.ToTable("Catalog");
|
||||||
|
|
||||||
builder.Property(ci => ci.Id)
|
builder.Property(ci => ci.Id)
|
||||||
.ForSqlServerUseSequenceHiLo("catalog_hilo")
|
.UseHiLo("catalog_hilo")
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
builder.Property(ci => ci.Name)
|
builder.Property(ci => ci.Name)
|
||||||
|
|||||||
@@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -12,7 +12,29 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Config
|
|||||||
|
|
||||||
navigation.SetPropertyAccessMode(PropertyAccessMode.Field);
|
navigation.SetPropertyAccessMode(PropertyAccessMode.Field);
|
||||||
|
|
||||||
builder.OwnsOne(o => o.ShipToAddress);
|
builder.OwnsOne(o => o.ShipToAddress, a =>
|
||||||
|
{
|
||||||
|
a.WithOwner();
|
||||||
|
|
||||||
|
a.Property(a => a.ZipCode)
|
||||||
|
.HasMaxLength(18)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
a.Property(a => a.Street)
|
||||||
|
.HasMaxLength(180)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
a.Property(a => a.State)
|
||||||
|
.HasMaxLength(60);
|
||||||
|
|
||||||
|
a.Property(a => a.Country)
|
||||||
|
.HasMaxLength(90)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
a.Property(a => a.City)
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,14 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Config
|
|||||||
{
|
{
|
||||||
public void Configure(EntityTypeBuilder<OrderItem> builder)
|
public void Configure(EntityTypeBuilder<OrderItem> builder)
|
||||||
{
|
{
|
||||||
builder.OwnsOne(i => i.ItemOrdered);
|
builder.OwnsOne(i => i.ItemOrdered, io =>
|
||||||
|
{
|
||||||
|
io.WithOwner();
|
||||||
|
|
||||||
|
io.Property(cio => cio.ProductName)
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
builder.Property(oi => oi.UnitPrice)
|
builder.Property(oi => oi.UnitPrice)
|
||||||
.IsRequired(true)
|
.IsRequired(true)
|
||||||
|
|||||||
274
src/Infrastructure/Data/Migrations/20191031185508_Post30Upgrade.Designer.cs
generated
Normal file
274
src/Infrastructure/Data/Migrations/20191031185508_Post30Upgrade.Designer.cs
generated
Normal file
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
285
src/Infrastructure/Data/Migrations/20191105161820_AddressAndCatalogItemOrderedChanges.Designer.cs
generated
Normal file
285
src/Infrastructure/Data/Migrations/20191105161820_AddressAndCatalogItemOrderedChanges.Designer.cs
generated
Normal file
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
|
|||||||
{
|
{
|
||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
|
.HasAnnotation("ProductVersion", "3.0.0")
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||||
.HasAnnotation("Relational:Sequence:.catalog_brand_hilo", "'catalog_brand_hilo', '', '1', '10', '', '', 'Int64', 'False'")
|
.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_hilo", "'catalog_hilo', '', '1', '10', '', '', 'Int64', 'False'")
|
||||||
@@ -26,9 +26,13 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||||
|
|
||||||
b.Property<string>("BuyerId");
|
b.Property<string>("BuyerId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(40)")
|
||||||
|
.HasMaxLength(40);
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@@ -39,13 +43,17 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||||
|
|
||||||
b.Property<int>("BasketId");
|
b.Property<int>("BasketId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int>("CatalogItemId");
|
b.Property<int>("CatalogItemId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int>("Quantity");
|
b.Property<int>("Quantity")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<decimal>("UnitPrice")
|
b.Property<decimal>("UnitPrice")
|
||||||
.HasColumnType("decimal(18,2)");
|
.HasColumnType("decimal(18,2)");
|
||||||
@@ -61,36 +69,44 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_brand_hilo")
|
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_brand_hilo")
|
||||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
|
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
|
||||||
|
|
||||||
b.Property<string>("Brand")
|
b.Property<string>("Brand")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(100)")
|
||||||
.HasMaxLength(100);
|
.HasMaxLength(100);
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("CatalogBrand");
|
b.ToTable("CatalogBrands");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogItem", b =>
|
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogItem", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_hilo")
|
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_hilo")
|
||||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
|
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
|
||||||
|
|
||||||
b.Property<int>("CatalogBrandId");
|
b.Property<int>("CatalogBrandId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int>("CatalogTypeId");
|
b.Property<int>("CatalogTypeId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<string>("Description");
|
b.Property<string>("Description")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(50)")
|
||||||
.HasMaxLength(50);
|
.HasMaxLength(50);
|
||||||
|
|
||||||
b.Property<string>("PictureUri");
|
b.Property<string>("PictureUri")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<decimal>("Price")
|
b.Property<decimal>("Price")
|
||||||
.HasColumnType("decimal(18,2)");
|
.HasColumnType("decimal(18,2)");
|
||||||
@@ -108,27 +124,32 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_type_hilo")
|
.HasAnnotation("SqlServer:HiLoSequenceName", "catalog_type_hilo")
|
||||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
|
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
|
||||||
|
|
||||||
b.Property<string>("Type")
|
b.Property<string>("Type")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(100)")
|
||||||
.HasMaxLength(100);
|
.HasMaxLength(100);
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("CatalogType");
|
b.ToTable("CatalogTypes");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order", b =>
|
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||||
|
|
||||||
b.Property<string>("BuyerId");
|
b.Property<string>("BuyerId")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<DateTimeOffset>("OrderDate");
|
b.Property<DateTimeOffset>("OrderDate")
|
||||||
|
.HasColumnType("datetimeoffset");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@@ -139,14 +160,17 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
|
|||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||||
|
|
||||||
b.Property<int?>("OrderId");
|
b.Property<int?>("OrderId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<decimal>("UnitPrice")
|
b.Property<decimal>("UnitPrice")
|
||||||
.HasColumnType("decimal(18,2)");
|
.HasColumnType("decimal(18,2)");
|
||||||
|
|
||||||
b.Property<int>("Units");
|
b.Property<int>("Units")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
@@ -157,10 +181,11 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.BasketItem", b =>
|
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.BasketItem", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.Basket")
|
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate.Basket", null)
|
||||||
.WithMany("Items")
|
.WithMany("Items")
|
||||||
.HasForeignKey("BasketId")
|
.HasForeignKey("BasketId")
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogItem", b =>
|
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogItem", b =>
|
||||||
@@ -168,12 +193,14 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
|
|||||||
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogBrand", "CatalogBrand")
|
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogBrand", "CatalogBrand")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("CatalogBrandId")
|
.HasForeignKey("CatalogBrandId")
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogType", "CatalogType")
|
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.CatalogType", "CatalogType")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("CatalogTypeId")
|
.HasForeignKey("CatalogTypeId")
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order", b =>
|
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order", b =>
|
||||||
@@ -182,41 +209,45 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
|
|||||||
{
|
{
|
||||||
b1.Property<int>("OrderId")
|
b1.Property<int>("OrderId")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||||
|
|
||||||
b1.Property<string>("City")
|
b1.Property<string>("City")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(100)")
|
||||||
.HasMaxLength(100);
|
.HasMaxLength(100);
|
||||||
|
|
||||||
b1.Property<string>("Country")
|
b1.Property<string>("Country")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(90)")
|
||||||
.HasMaxLength(90);
|
.HasMaxLength(90);
|
||||||
|
|
||||||
b1.Property<string>("State")
|
b1.Property<string>("State")
|
||||||
|
.HasColumnType("nvarchar(60)")
|
||||||
.HasMaxLength(60);
|
.HasMaxLength(60);
|
||||||
|
|
||||||
b1.Property<string>("Street")
|
b1.Property<string>("Street")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(180)")
|
||||||
.HasMaxLength(180);
|
.HasMaxLength(180);
|
||||||
|
|
||||||
b1.Property<string>("ZipCode")
|
b1.Property<string>("ZipCode")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(18)")
|
||||||
.HasMaxLength(18);
|
.HasMaxLength(18);
|
||||||
|
|
||||||
b1.HasKey("OrderId");
|
b1.HasKey("OrderId");
|
||||||
|
|
||||||
b1.ToTable("Orders");
|
b1.ToTable("Orders");
|
||||||
|
|
||||||
b1.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order")
|
b1.WithOwner()
|
||||||
.WithOne("ShipToAddress")
|
.HasForeignKey("OrderId");
|
||||||
.HasForeignKey("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Address", "OrderId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.OrderItem", b =>
|
modelBuilder.Entity("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.OrderItem", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order")
|
b.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.Order", null)
|
||||||
.WithMany("OrderItems")
|
.WithMany("OrderItems")
|
||||||
.HasForeignKey("OrderId");
|
.HasForeignKey("OrderId");
|
||||||
|
|
||||||
@@ -224,24 +255,26 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
|
|||||||
{
|
{
|
||||||
b1.Property<int>("OrderItemId")
|
b1.Property<int>("OrderItemId")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||||
|
|
||||||
b1.Property<int>("CatalogItemId");
|
b1.Property<int>("CatalogItemId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b1.Property<string>("PictureUri");
|
b1.Property<string>("PictureUri")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b1.Property<string>("ProductName")
|
b1.Property<string>("ProductName")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(50)")
|
||||||
.HasMaxLength(50);
|
.HasMaxLength(50);
|
||||||
|
|
||||||
b1.HasKey("OrderItemId");
|
b1.HasKey("OrderItemId");
|
||||||
|
|
||||||
b1.ToTable("OrderItems");
|
b1.ToTable("OrderItems");
|
||||||
|
|
||||||
b1.HasOne("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.OrderItem")
|
b1.WithOwner()
|
||||||
.WithOne("ItemOrdered")
|
.HasForeignKey("OrderItemId");
|
||||||
.HasForeignKey("Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate.CatalogItemOrdered", "OrderItemId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>netstandard2.1</TargetFramework>
|
||||||
<RootNamespace>Microsoft.eShopWeb.Infrastructure</RootNamespace>
|
<RootNamespace>Microsoft.eShopWeb.Infrastructure</RootNamespace>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Ardalis.EFCore.Extensions" Version="1.1.0" />
|
<PackageReference Include="Ardalis.EFCore.Extensions" Version="1.1.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.2.0" />
|
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.2.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="2.2.0" />
|
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.0.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.6" PrivateAssets="All" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.0.0" PrivateAssets="All" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\ApplicationCore\ApplicationCore.csproj" />
|
<ProjectReference Include="..\ApplicationCore\ApplicationCore.csproj" />
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#
|
#
|
||||||
# RUN COMMAND
|
# RUN COMMAND
|
||||||
# docker run --name eshopweb --rm -it -p 5106:5106 web
|
# docker run --name eshopweb --rm -it -p 5106:5106 web
|
||||||
FROM microsoft/dotnet:2.2-sdk AS build
|
FROM mcr.microsoft.com/dotnet/core/sdk:3.0 AS build
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY *.sln .
|
COPY *.sln .
|
||||||
@@ -17,7 +17,7 @@ RUN dotnet restore
|
|||||||
|
|
||||||
RUN dotnet publish -c Release -o out
|
RUN dotnet publish -c Release -o out
|
||||||
|
|
||||||
FROM microsoft/dotnet:2.2-aspnetcore-runtime AS runtime
|
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0 AS runtime
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=build /app/src/Web/out ./
|
COPY --from=build /app/src/Web/out ./
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
using Microsoft.AspNetCore;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
|
||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.eShopWeb.Infrastructure.Data;
|
using Microsoft.eShopWeb.Infrastructure.Data;
|
||||||
using Microsoft.eShopWeb.Infrastructure.Identity;
|
using Microsoft.eShopWeb.Infrastructure.Identity;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -14,7 +14,7 @@ namespace Microsoft.eShopWeb.Web
|
|||||||
{
|
{
|
||||||
public async static Task Main(string[] args)
|
public async static Task Main(string[] args)
|
||||||
{
|
{
|
||||||
var host = CreateWebHostBuilder(args)
|
var host = CreateHostBuilder(args)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
using (var scope = host.Services.CreateScope())
|
using (var scope = host.Services.CreateScope())
|
||||||
@@ -39,8 +39,11 @@ namespace Microsoft.eShopWeb.Web
|
|||||||
host.Run();
|
host.Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
|
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||||
WebHost.CreateDefaultBuilder(args)
|
Host.CreateDefaultBuilder(args)
|
||||||
.UseStartup<Startup>();
|
.ConfigureWebHostDefaults(webBuilder =>
|
||||||
|
{
|
||||||
|
webBuilder.UseStartup<Startup>();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,7 @@ using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
|||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.AspNetCore.Identity.UI;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.AspNetCore.Mvc.ApplicationModels;
|
using Microsoft.AspNetCore.Mvc.ApplicationModels;
|
||||||
using Microsoft.AspNetCore.Routing;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.eShopWeb.ApplicationCore.Interfaces;
|
using Microsoft.eShopWeb.ApplicationCore.Interfaces;
|
||||||
using Microsoft.eShopWeb.ApplicationCore.Services;
|
using Microsoft.eShopWeb.ApplicationCore.Services;
|
||||||
@@ -15,14 +12,13 @@ using Microsoft.eShopWeb.Infrastructure.Data;
|
|||||||
using Microsoft.eShopWeb.Infrastructure.Identity;
|
using Microsoft.eShopWeb.Infrastructure.Identity;
|
||||||
using Microsoft.eShopWeb.Infrastructure.Logging;
|
using Microsoft.eShopWeb.Infrastructure.Logging;
|
||||||
using Microsoft.eShopWeb.Infrastructure.Services;
|
using Microsoft.eShopWeb.Infrastructure.Services;
|
||||||
using Microsoft.eShopWeb.Web.HealthChecks;
|
|
||||||
using Microsoft.eShopWeb.Web.Interfaces;
|
using Microsoft.eShopWeb.Web.Interfaces;
|
||||||
using Microsoft.eShopWeb.Web.Services;
|
using Microsoft.eShopWeb.Web.Services;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Swashbuckle.AspNetCore.Swagger;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -87,7 +83,6 @@ namespace Microsoft.eShopWeb.Web
|
|||||||
CreateIdentityIfNotCreated(services);
|
CreateIdentityIfNotCreated(services);
|
||||||
|
|
||||||
services.AddScoped(typeof(IAsyncRepository<>), typeof(EfRepository<>));
|
services.AddScoped(typeof(IAsyncRepository<>), typeof(EfRepository<>));
|
||||||
|
|
||||||
services.AddScoped<ICatalogViewModelService, CachedCatalogViewModelService>();
|
services.AddScoped<ICatalogViewModelService, CachedCatalogViewModelService>();
|
||||||
services.AddScoped<IBasketService, BasketService>();
|
services.AddScoped<IBasketService, BasketService>();
|
||||||
services.AddScoped<IBasketViewModelService, BasketViewModelService>();
|
services.AddScoped<IBasketViewModelService, BasketViewModelService>();
|
||||||
@@ -96,7 +91,6 @@ namespace Microsoft.eShopWeb.Web
|
|||||||
services.AddScoped<CatalogViewModelService>();
|
services.AddScoped<CatalogViewModelService>();
|
||||||
services.Configure<CatalogSettings>(Configuration);
|
services.Configure<CatalogSettings>(Configuration);
|
||||||
services.AddSingleton<IUriComposer>(new UriComposer(Configuration.Get<CatalogSettings>()));
|
services.AddSingleton<IUriComposer>(new UriComposer(Configuration.Get<CatalogSettings>()));
|
||||||
|
|
||||||
services.AddScoped(typeof(IAppLogger<>), typeof(LoggerAdapter<>));
|
services.AddScoped(typeof(IAppLogger<>), typeof(LoggerAdapter<>));
|
||||||
services.AddTransient<IEmailSender, EmailSender>();
|
services.AddTransient<IEmailSender, EmailSender>();
|
||||||
|
|
||||||
@@ -115,24 +109,20 @@ namespace Microsoft.eShopWeb.Web
|
|||||||
options.Conventions.Add(new RouteTokenTransformerConvention(
|
options.Conventions.Add(new RouteTokenTransformerConvention(
|
||||||
new SlugifyParameterTransformer()));
|
new SlugifyParameterTransformer()));
|
||||||
|
|
||||||
}
|
});
|
||||||
)
|
services.AddControllersWithViews();
|
||||||
.AddRazorPagesOptions(options =>
|
services.AddRazorPages(options =>
|
||||||
{
|
|
||||||
options.Conventions.AuthorizePage("/Basket/Checkout");
|
|
||||||
options.AllowAreas = true;
|
|
||||||
})
|
|
||||||
.SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
|
|
||||||
|
|
||||||
services.AddHttpContextAccessor();
|
|
||||||
services.AddSwaggerGen(c =>
|
|
||||||
{
|
{
|
||||||
c.SwaggerDoc("v1", new Info { Title = "My API", Version = "v1" });
|
options.Conventions.AuthorizePage("/Basket/Checkout");
|
||||||
});
|
});
|
||||||
|
|
||||||
services.AddHealthChecks()
|
services.AddControllers();
|
||||||
.AddCheck<HomePageHealthCheck>("home_page_health_check")
|
|
||||||
.AddCheck<ApiHealthCheck>("api_health_check");
|
services.AddHttpContextAccessor();
|
||||||
|
|
||||||
|
services.AddSwaggerGen(c => c.SwaggerDoc("v1", new OpenApi.Models.OpenApiInfo { Title = "My API", Version = "v1"}));
|
||||||
|
|
||||||
|
services.AddHealthChecks();
|
||||||
|
|
||||||
services.Configure<ServiceConfig>(config =>
|
services.Configure<ServiceConfig>(config =>
|
||||||
{
|
{
|
||||||
@@ -154,7 +144,7 @@ namespace Microsoft.eShopWeb.Web
|
|||||||
if(existingUserManager == null)
|
if(existingUserManager == null)
|
||||||
{
|
{
|
||||||
services.AddIdentity<ApplicationUser, IdentityRole>()
|
services.AddIdentity<ApplicationUser, IdentityRole>()
|
||||||
.AddDefaultUI(UIFramework.Bootstrap4)
|
.AddDefaultUI()
|
||||||
.AddEntityFrameworkStores<AppIdentityDbContext>()
|
.AddEntityFrameworkStores<AppIdentityDbContext>()
|
||||||
.AddDefaultTokenProviders();
|
.AddDefaultTokenProviders();
|
||||||
}
|
}
|
||||||
@@ -183,9 +173,8 @@ namespace Microsoft.eShopWeb.Web
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||||
{
|
{
|
||||||
//app.UseDeveloperExceptionPage();
|
|
||||||
app.UseHealthChecks("/health",
|
app.UseHealthChecks("/health",
|
||||||
new HealthCheckOptions
|
new HealthCheckOptions
|
||||||
{
|
{
|
||||||
@@ -220,9 +209,11 @@ namespace Microsoft.eShopWeb.Web
|
|||||||
|
|
||||||
app.UseHttpsRedirection();
|
app.UseHttpsRedirection();
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
app.UseCookiePolicy();
|
app.UseRouting();
|
||||||
|
|
||||||
|
app.UseCookiePolicy();
|
||||||
app.UseAuthentication();
|
app.UseAuthentication();
|
||||||
|
app.UseAuthorization();
|
||||||
|
|
||||||
// Enable middleware to serve generated Swagger as a JSON endpoint.
|
// Enable middleware to serve generated Swagger as a JSON endpoint.
|
||||||
app.UseSwagger();
|
app.UseSwagger();
|
||||||
@@ -234,11 +225,12 @@ namespace Microsoft.eShopWeb.Web
|
|||||||
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
|
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
|
||||||
});
|
});
|
||||||
|
|
||||||
app.UseMvc(routes =>
|
app.UseEndpoints(endpoints =>
|
||||||
{
|
{
|
||||||
routes.MapRoute(
|
endpoints.MapControllerRoute("default", "{controller:slugify=Home}/{action:slugify=Index}/{id?}");
|
||||||
name: "default",
|
endpoints.MapRazorPages();
|
||||||
template: "{controller:slugify=Home}/{action:slugify=Index}/{id?}");
|
endpoints.MapHealthChecks("home_page_health_check");
|
||||||
|
endpoints.MapHealthChecks("api_health_check");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
<RootNamespace>Microsoft.eShopWeb.Web</RootNamespace>
|
<RootNamespace>Microsoft.eShopWeb.Web</RootNamespace>
|
||||||
<UserSecretsId>aspnet-Web2-1FA3F72E-E7E3-4360-9E49-1CCCD7FE85F7</UserSecretsId>
|
<UserSecretsId>aspnet-Web2-1FA3F72E-E7E3-4360-9E49-1CCCD7FE85F7</UserSecretsId>
|
||||||
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
|
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
@@ -16,12 +15,20 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Ardalis.ListStartupServices" Version="1.1.3" />
|
<PackageReference Include="Ardalis.ListStartupServices" Version="1.1.3" />
|
||||||
<PackageReference Include="BuildBundlerMinifier" Version="2.9.406" Condition="'$(Configuration)'=='Release'" PrivateAssets="All" />
|
<PackageReference Include="BuildBundlerMinifier" Version="2.9.406" Condition="'$(Configuration)'=='Release'" PrivateAssets="All" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.App" />
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
|
|
||||||
<PackageReference Include="Microsoft.CodeAnalysis" Version="3.3.1" />
|
<PackageReference Include="Microsoft.CodeAnalysis" Version="3.3.1" />
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.4" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="3.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0" />
|
||||||
<PackageReference Include="Microsoft.Web.LibraryManager.Build" Version="2.0.96" />
|
<PackageReference Include="Microsoft.Web.LibraryManager.Build" Version="2.0.96" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0-rc2" />
|
||||||
|
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="5.0.0-rc4" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="3.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="3.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.0.0">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="wwwroot\fonts\" />
|
<Folder Include="wwwroot\fonts\" />
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
<RootNamespace>Microsoft.eShopWeb.FunctionalTests</RootNamespace>
|
<RootNamespace>Microsoft.eShopWeb.FunctionalTests</RootNamespace>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@@ -13,15 +13,14 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.App" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="3.0.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="2.2.0" />
|
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
|
||||||
<PackageReference Include="xunit" Version="2.4.1" />
|
<PackageReference Include="xunit" Version="2.4.1" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="3.0.0" />
|
||||||
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
|
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ using Xunit;
|
|||||||
|
|
||||||
namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
|
namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
|
||||||
{
|
{
|
||||||
|
[Collection("Sequential")]
|
||||||
public class AccountControllerSignIn : IClassFixture<CustomWebApplicationFactory<Startup>>
|
public class AccountControllerSignIn : IClassFixture<CustomWebApplicationFactory<Startup>>
|
||||||
{
|
{
|
||||||
public AccountControllerSignIn(CustomWebApplicationFactory<Startup> factory)
|
public AccountControllerSignIn(CustomWebApplicationFactory<Startup> factory)
|
||||||
@@ -42,7 +43,7 @@ namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
|
|||||||
string regexpression = @"name=""__RequestVerificationToken"" type=""hidden"" value=""([-A-Za-z0-9+=/\\_]+?)""";
|
string regexpression = @"name=""__RequestVerificationToken"" type=""hidden"" value=""([-A-Za-z0-9+=/\\_]+?)""";
|
||||||
var regex = new Regex(regexpression);
|
var regex = new Regex(regexpression);
|
||||||
var match = regex.Match(input);
|
var match = regex.Match(input);
|
||||||
var group = match.Groups.LastOrDefault();
|
var group = match.Groups.Values.LastOrDefault();
|
||||||
Assert.NotNull(group);
|
Assert.NotNull(group);
|
||||||
Assert.True(group.Value.Length > 50);
|
Assert.True(group.Value.Length > 50);
|
||||||
}
|
}
|
||||||
@@ -63,7 +64,7 @@ namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
|
|||||||
string regexpression = @"name=""__RequestVerificationToken"" type=""hidden"" value=""([-A-Za-z0-9+=/\\_]+?)""";
|
string regexpression = @"name=""__RequestVerificationToken"" type=""hidden"" value=""([-A-Za-z0-9+=/\\_]+?)""";
|
||||||
var regex = new Regex(regexpression);
|
var regex = new Regex(regexpression);
|
||||||
var match = regex.Match(input);
|
var match = regex.Match(input);
|
||||||
return match.Groups.LastOrDefault().Value;
|
return match.Groups.Values.LastOrDefault().Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Xunit;
|
|||||||
|
|
||||||
namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
|
namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
|
||||||
{
|
{
|
||||||
|
[Collection("Sequential")]
|
||||||
public class ApiCatalogControllerList : IClassFixture<CustomWebApplicationFactory<Startup>>
|
public class ApiCatalogControllerList : IClassFixture<CustomWebApplicationFactory<Startup>>
|
||||||
{
|
{
|
||||||
public ApiCatalogControllerList(CustomWebApplicationFactory<Startup> factory)
|
public ApiCatalogControllerList(CustomWebApplicationFactory<Startup> factory)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Xunit;
|
|||||||
|
|
||||||
namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
|
namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
|
||||||
{
|
{
|
||||||
|
[Collection("Sequential")]
|
||||||
public class CatalogControllerIndex : IClassFixture<CustomWebApplicationFactory<Startup>>
|
public class CatalogControllerIndex : IClassFixture<CustomWebApplicationFactory<Startup>>
|
||||||
{
|
{
|
||||||
public CatalogControllerIndex(CustomWebApplicationFactory<Startup> factory)
|
public CatalogControllerIndex(CustomWebApplicationFactory<Startup> factory)
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Xunit;
|
|||||||
|
|
||||||
namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
|
namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
|
||||||
{
|
{
|
||||||
|
[Collection("Sequential")]
|
||||||
public class OrderIndexOnGet : IClassFixture<CustomWebApplicationFactory<Startup>>
|
public class OrderIndexOnGet : IClassFixture<CustomWebApplicationFactory<Startup>>
|
||||||
{
|
{
|
||||||
public OrderIndexOnGet(CustomWebApplicationFactory<Startup> factory)
|
public OrderIndexOnGet(CustomWebApplicationFactory<Startup> factory)
|
||||||
|
|||||||
@@ -40,11 +40,6 @@ namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
|
|||||||
options.UseInternalServiceProvider(provider);
|
options.UseInternalServiceProvider(provider);
|
||||||
});
|
});
|
||||||
|
|
||||||
services.AddIdentity<ApplicationUser, IdentityRole>()
|
|
||||||
.AddDefaultUI(UIFramework.Bootstrap4)
|
|
||||||
.AddEntityFrameworkStores<AppIdentityDbContext>()
|
|
||||||
.AddDefaultTokenProviders();
|
|
||||||
|
|
||||||
// Build the service provider.
|
// Build the service provider.
|
||||||
var sp = services.BuildServiceProvider();
|
var sp = services.BuildServiceProvider();
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ using Xunit;
|
|||||||
|
|
||||||
namespace Microsoft.eShopWeb.FunctionalTests.WebRazorPages
|
namespace Microsoft.eShopWeb.FunctionalTests.WebRazorPages
|
||||||
{
|
{
|
||||||
|
[Collection("Sequential")]
|
||||||
public class BasketPageCheckout : IClassFixture<CustomWebApplicationFactory<Startup>>
|
public class BasketPageCheckout : IClassFixture<CustomWebApplicationFactory<Startup>>
|
||||||
{
|
{
|
||||||
public BasketPageCheckout(CustomWebApplicationFactory<Startup> factory)
|
public BasketPageCheckout(CustomWebApplicationFactory<Startup> factory)
|
||||||
@@ -28,7 +29,7 @@ namespace Microsoft.eShopWeb.FunctionalTests.WebRazorPages
|
|||||||
string regexpression = @"name=""__RequestVerificationToken"" type=""hidden"" value=""([-A-Za-z0-9+=/\\_]+?)""";
|
string regexpression = @"name=""__RequestVerificationToken"" type=""hidden"" value=""([-A-Za-z0-9+=/\\_]+?)""";
|
||||||
var regex = new Regex(regexpression);
|
var regex = new Regex(regexpression);
|
||||||
var match = regex.Match(input);
|
var match = regex.Match(input);
|
||||||
return match.Groups.LastOrDefault().Value;
|
return match.Groups.Values.LastOrDefault().Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using Xunit;
|
|||||||
|
|
||||||
namespace Microsoft.eShopWeb.FunctionalTests.WebRazorPages
|
namespace Microsoft.eShopWeb.FunctionalTests.WebRazorPages
|
||||||
{
|
{
|
||||||
|
[Collection("Sequential")]
|
||||||
public class HomePageOnGet : IClassFixture<CustomWebApplicationFactory<Startup>>
|
public class HomePageOnGet : IClassFixture<CustomWebApplicationFactory<Startup>>
|
||||||
{
|
{
|
||||||
public HomePageOnGet(CustomWebApplicationFactory<Startup> factory)
|
public HomePageOnGet(CustomWebApplicationFactory<Startup> factory)
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
<RootNamespace>Microsoft.eShopWeb.IntegrationTests</RootNamespace>
|
<RootNamespace>Microsoft.eShopWeb.IntegrationTests</RootNamespace>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="3.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
|
||||||
<PackageReference Include="Moq" Version="4.13.0" />
|
<PackageReference Include="Moq" Version="4.13.1" />
|
||||||
<PackageReference Include="xunit" Version="2.4.1" />
|
<PackageReference Include="xunit" Version="2.4.1" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
<RootNamespace>Microsoft.eShopWeb.UnitTests</RootNamespace>
|
<RootNamespace>Microsoft.eShopWeb.UnitTests</RootNamespace>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
|
||||||
<PackageReference Include="Moq" Version="4.13.0" />
|
<PackageReference Include="Moq" Version="4.13.1" />
|
||||||
<PackageReference Include="xunit" Version="2.4.1" />
|
<PackageReference Include="xunit" Version="2.4.1" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
|||||||
Reference in New Issue
Block a user