Initial Upgrade to .NET Core 2.0 (#50)
* Ardalis/upgrade1 (#44) * Upgrading to netcore 2.0 Updating repository to support async options and refactoring to use it. * Starting work on tracking customer orders feature. * Cleaning up some bugs Working on basket view component implementation * Fixing up styles, especially for basket in header. * Adding Order Features (#47) * Working on order model binding from checkout page - WIP * Small layout tweaks (#43) * Updating quantities implemented. * Fixed basket widget count * Order History (#49) * working on creating and viewing orders. * Working on wiring up listing of orders * List orders page works as expected. Needed to support ThenInclude scenarios. Currently using strings.
This commit is contained in:
@@ -3,6 +3,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using Microsoft.eShopWeb.ApplicationCore.Entities;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using ApplicationCore.Entities.OrderAggregate;
|
||||
|
||||
namespace Infrastructure.Data
|
||||
{
|
||||
@@ -20,6 +21,8 @@ namespace Infrastructure.Data
|
||||
public DbSet<CatalogItem> CatalogItems { get; set; }
|
||||
public DbSet<CatalogBrand> CatalogBrands { get; set; }
|
||||
public DbSet<CatalogType> CatalogTypes { get; set; }
|
||||
public DbSet<Order> Orders { get; set; }
|
||||
public DbSet<OrderItem> OrderItems { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
@@ -27,6 +30,8 @@ namespace Infrastructure.Data
|
||||
builder.Entity<CatalogBrand>(ConfigureCatalogBrand);
|
||||
builder.Entity<CatalogType>(ConfigureCatalogType);
|
||||
builder.Entity<CatalogItem>(ConfigureCatalogItem);
|
||||
builder.Entity<Order>(ConfigureOrder);
|
||||
builder.Entity<OrderItem>(ConfigureOrderItem);
|
||||
}
|
||||
|
||||
private void ConfigureBasket(EntityTypeBuilder<Basket> builder)
|
||||
@@ -36,7 +41,7 @@ namespace Infrastructure.Data
|
||||
navigation.SetPropertyAccessMode(PropertyAccessMode.Field);
|
||||
}
|
||||
|
||||
void ConfigureCatalogItem(EntityTypeBuilder<CatalogItem> builder)
|
||||
private void ConfigureCatalogItem(EntityTypeBuilder<CatalogItem> builder)
|
||||
{
|
||||
builder.ToTable("Catalog");
|
||||
|
||||
@@ -63,7 +68,7 @@ namespace Infrastructure.Data
|
||||
.HasForeignKey(ci => ci.CatalogTypeId);
|
||||
}
|
||||
|
||||
void ConfigureCatalogBrand(EntityTypeBuilder<CatalogBrand> builder)
|
||||
private void ConfigureCatalogBrand(EntityTypeBuilder<CatalogBrand> builder)
|
||||
{
|
||||
builder.ToTable("CatalogBrand");
|
||||
|
||||
@@ -78,7 +83,7 @@ namespace Infrastructure.Data
|
||||
.HasMaxLength(100);
|
||||
}
|
||||
|
||||
void ConfigureCatalogType(EntityTypeBuilder<CatalogType> builder)
|
||||
private void ConfigureCatalogType(EntityTypeBuilder<CatalogType> builder)
|
||||
{
|
||||
builder.ToTable("CatalogType");
|
||||
|
||||
@@ -92,5 +97,14 @@ namespace Infrastructure.Data
|
||||
.IsRequired()
|
||||
.HasMaxLength(100);
|
||||
}
|
||||
private void ConfigureOrder(EntityTypeBuilder<Order> builder)
|
||||
{
|
||||
builder.OwnsOne(o => o.ShipToAddress);
|
||||
}
|
||||
private void ConfigureOrderItem(EntityTypeBuilder<OrderItem> builder)
|
||||
{
|
||||
builder.OwnsOne(i => i.ItemOrdered);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user