From 607d1ca2fa4c05755920eed171fd2c75b83a6e84 Mon Sep 17 00:00:00 2001 From: Unai Zorrilla Castro Date: Fri, 27 Jan 2017 11:38:23 +0100 Subject: [PATCH] Fix query with new model. Add missing properties into migration. Work on github issues --- .../Commands/CreateOrderCommandHandler.cs | 2 +- .../Controllers/OrdersController.cs | 1 + ...orizationHeaderParameterOperationFilter.cs | 2 -- ....cs => 20170127103457_Initial.Designer.cs} | 23 +++++++------ ...3_Initial.cs => 20170127103457_Initial.cs} | 32 ++++++++++--------- .../OrderingContextModelSnapshot.cs | 21 +++++++----- .../AggregatesModel/BuyerAggregate/Buyer.cs | 14 ++++---- .../AggregatesModel/BuyerAggregate/Payment.cs | 6 ++-- .../OrderAggregate/IOrderRepository.cs | 3 +- .../AggregatesModel/OrderAggregate/Order.cs | 9 +++--- .../OrderingContext.cs | 23 +++++++------ .../Repositories/BuyerRepository.cs | 2 +- 12 files changed, 76 insertions(+), 62 deletions(-) rename src/Services/Ordering/Ordering.API/Infrastructure/Migrations/{20170125143653_Initial.Designer.cs => 20170127103457_Initial.Designer.cs} (92%) rename src/Services/Ordering/Ordering.API/Infrastructure/Migrations/{20170125143653_Initial.cs => 20170127103457_Initial.cs} (90%) diff --git a/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommandHandler.cs b/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommandHandler.cs index 92a5e691d..576aa61b7 100644 --- a/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommandHandler.cs +++ b/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommandHandler.cs @@ -39,7 +39,7 @@ buyer = new Buyer(message.BuyerFullName); } - var payment = buyer.AddPayment(message.CardTypeId, + var payment = buyer.AddPaymentMethod(message.CardTypeId, $"Payment Method on {DateTime.UtcNow}", message.CardNumber, message.CardSecurityNumber, diff --git a/src/Services/Ordering/Ordering.API/Controllers/OrdersController.cs b/src/Services/Ordering/Ordering.API/Controllers/OrdersController.cs index eb6df071c..2226c95e4 100644 --- a/src/Services/Ordering/Ordering.API/Controllers/OrdersController.cs +++ b/src/Services/Ordering/Ordering.API/Controllers/OrdersController.cs @@ -1,4 +1,5 @@ using MediatR; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands; using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Queries; diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/Auth/AuthorizationHeaderParameterOperationFilter.cs b/src/Services/Ordering/Ordering.API/Infrastructure/Auth/AuthorizationHeaderParameterOperationFilter.cs index 94e2a48c2..2b5b33fd7 100644 --- a/src/Services/Ordering/Ordering.API/Infrastructure/Auth/AuthorizationHeaderParameterOperationFilter.cs +++ b/src/Services/Ordering/Ordering.API/Infrastructure/Auth/AuthorizationHeaderParameterOperationFilter.cs @@ -1,10 +1,8 @@ using Microsoft.AspNetCore.Mvc.Authorization; using Swashbuckle.Swagger.Model; using Swashbuckle.SwaggerGen.Generator; -using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Auth { diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/20170125143653_Initial.Designer.cs b/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/20170127103457_Initial.Designer.cs similarity index 92% rename from src/Services/Ordering/Ordering.API/Infrastructure/Migrations/20170125143653_Initial.Designer.cs rename to src/Services/Ordering/Ordering.API/Infrastructure/Migrations/20170127103457_Initial.Designer.cs index 497f5a95b..cf7e5fdfb 100644 --- a/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/20170125143653_Initial.Designer.cs +++ b/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/20170127103457_Initial.Designer.cs @@ -8,7 +8,7 @@ using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure; namespace Ordering.API.Migrations { [DbContext(typeof(OrderingContext))] - [Migration("20170125143653_Initial")] + [Migration("20170127103457_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -55,7 +55,7 @@ namespace Ordering.API.Migrations b.ToTable("cardtypes","ordering"); }); - modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate.Payment", b => + modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate.PaymentMethod", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -87,7 +87,7 @@ namespace Ordering.API.Migrations b.HasIndex("CardTypeId"); - b.ToTable("payments","ordering"); + b.ToTable("paymentmethods","ordering"); }); modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate.Order", b => @@ -103,11 +103,14 @@ namespace Ordering.API.Migrations b.Property("City") .IsRequired(); + b.Property("Country") + .IsRequired(); + b.Property("OrderDate"); b.Property("OrderStatusId"); - b.Property("PaymentId"); + b.Property("PaymentMethodId"); b.Property("State") .IsRequired(); @@ -124,7 +127,7 @@ namespace Ordering.API.Migrations b.HasIndex("OrderStatusId"); - b.HasIndex("PaymentId"); + b.HasIndex("PaymentMethodId"); b.ToTable("orders","ordering"); }); @@ -140,6 +143,8 @@ namespace Ordering.API.Migrations b.Property("OrderId"); + b.Property("PictureUrl"); + b.Property("ProductId"); b.Property("ProductName") @@ -170,10 +175,10 @@ namespace Ordering.API.Migrations b.ToTable("orderstatus","ordering"); }); - modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate.Payment", b => + modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate.PaymentMethod", b => { b.HasOne("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate.Buyer") - .WithMany("Payments") + .WithMany("PaymentMethods") .HasForeignKey("BuyerId") .OnDelete(DeleteBehavior.Cascade); @@ -195,9 +200,9 @@ namespace Ordering.API.Migrations .HasForeignKey("OrderStatusId") .OnDelete(DeleteBehavior.Cascade); - b.HasOne("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate.Payment", "Payment") + b.HasOne("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate.PaymentMethod", "PaymentMethod") .WithMany() - .HasForeignKey("PaymentId"); + .HasForeignKey("PaymentMethodId"); }); modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate.OrderItem", b => diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/20170125143653_Initial.cs b/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/20170127103457_Initial.cs similarity index 90% rename from src/Services/Ordering/Ordering.API/Infrastructure/Migrations/20170125143653_Initial.cs rename to src/Services/Ordering/Ordering.API/Infrastructure/Migrations/20170127103457_Initial.cs index 2787184c7..86a9403c4 100644 --- a/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/20170125143653_Initial.cs +++ b/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/20170127103457_Initial.cs @@ -70,7 +70,7 @@ namespace Ordering.API.Migrations }); migrationBuilder.CreateTable( - name: "payments", + name: "paymentmethods", schema: "ordering", columns: table => new { @@ -84,16 +84,16 @@ namespace Ordering.API.Migrations }, constraints: table => { - table.PrimaryKey("PK_payments", x => x.Id); + table.PrimaryKey("PK_paymentmethods", x => x.Id); table.ForeignKey( - name: "FK_payments_buyers_BuyerId", + name: "FK_paymentmethods_buyers_BuyerId", column: x => x.BuyerId, principalSchema: "ordering", principalTable: "buyers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( - name: "FK_payments_cardtypes_CardTypeId", + name: "FK_paymentmethods_cardtypes_CardTypeId", column: x => x.CardTypeId, principalSchema: "ordering", principalTable: "cardtypes", @@ -109,9 +109,10 @@ namespace Ordering.API.Migrations Id = table.Column(nullable: false), BuyerId = table.Column(nullable: false), City = table.Column(nullable: false), + Country = table.Column(nullable: false), OrderDate = table.Column(nullable: false), OrderStatusId = table.Column(nullable: false), - PaymentId = table.Column(nullable: false), + PaymentMethodId = table.Column(nullable: false), State = table.Column(nullable: false), Street = table.Column(nullable: false), ZipCode = table.Column(nullable: false) @@ -134,10 +135,10 @@ namespace Ordering.API.Migrations principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( - name: "FK_orders_payments_PaymentId", - column: x => x.PaymentId, + name: "FK_orders_paymentmethods_PaymentMethodId", + column: x => x.PaymentMethodId, principalSchema: "ordering", - principalTable: "payments", + principalTable: "paymentmethods", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); @@ -150,6 +151,7 @@ namespace Ordering.API.Migrations Id = table.Column(nullable: false), Discount = table.Column(nullable: false), OrderId = table.Column(nullable: false), + PictureUrl = table.Column(nullable: true), ProductId = table.Column(nullable: false), ProductName = table.Column(nullable: false), UnitPrice = table.Column(nullable: false), @@ -175,15 +177,15 @@ namespace Ordering.API.Migrations unique: true); migrationBuilder.CreateIndex( - name: "IX_payments_BuyerId", + name: "IX_paymentmethods_BuyerId", schema: "ordering", - table: "payments", + table: "paymentmethods", column: "BuyerId"); migrationBuilder.CreateIndex( - name: "IX_payments_CardTypeId", + name: "IX_paymentmethods_CardTypeId", schema: "ordering", - table: "payments", + table: "paymentmethods", column: "CardTypeId"); migrationBuilder.CreateIndex( @@ -199,10 +201,10 @@ namespace Ordering.API.Migrations column: "OrderStatusId"); migrationBuilder.CreateIndex( - name: "IX_orders_PaymentId", + name: "IX_orders_PaymentMethodId", schema: "ordering", table: "orders", - column: "PaymentId"); + column: "PaymentMethodId"); migrationBuilder.CreateIndex( name: "IX_orderItems_OrderId", @@ -226,7 +228,7 @@ namespace Ordering.API.Migrations schema: "ordering"); migrationBuilder.DropTable( - name: "payments", + name: "paymentmethods", schema: "ordering"); migrationBuilder.DropTable( diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/OrderingContextModelSnapshot.cs b/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/OrderingContextModelSnapshot.cs index 5aefd0de7..81402440a 100644 --- a/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/OrderingContextModelSnapshot.cs +++ b/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/OrderingContextModelSnapshot.cs @@ -54,7 +54,7 @@ namespace Ordering.API.Migrations b.ToTable("cardtypes","ordering"); }); - modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate.Payment", b => + modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate.PaymentMethod", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -86,7 +86,7 @@ namespace Ordering.API.Migrations b.HasIndex("CardTypeId"); - b.ToTable("payments","ordering"); + b.ToTable("paymentmethods","ordering"); }); modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate.Order", b => @@ -102,11 +102,14 @@ namespace Ordering.API.Migrations b.Property("City") .IsRequired(); + b.Property("Country") + .IsRequired(); + b.Property("OrderDate"); b.Property("OrderStatusId"); - b.Property("PaymentId"); + b.Property("PaymentMethodId"); b.Property("State") .IsRequired(); @@ -123,7 +126,7 @@ namespace Ordering.API.Migrations b.HasIndex("OrderStatusId"); - b.HasIndex("PaymentId"); + b.HasIndex("PaymentMethodId"); b.ToTable("orders","ordering"); }); @@ -139,6 +142,8 @@ namespace Ordering.API.Migrations b.Property("OrderId"); + b.Property("PictureUrl"); + b.Property("ProductId"); b.Property("ProductName") @@ -169,10 +174,10 @@ namespace Ordering.API.Migrations b.ToTable("orderstatus","ordering"); }); - modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate.Payment", b => + modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate.PaymentMethod", b => { b.HasOne("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate.Buyer") - .WithMany("Payments") + .WithMany("PaymentMethods") .HasForeignKey("BuyerId") .OnDelete(DeleteBehavior.Cascade); @@ -194,9 +199,9 @@ namespace Ordering.API.Migrations .HasForeignKey("OrderStatusId") .OnDelete(DeleteBehavior.Cascade); - b.HasOne("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate.Payment", "Payment") + b.HasOne("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate.PaymentMethod", "PaymentMethod") .WithMany() - .HasForeignKey("PaymentId"); + .HasForeignKey("PaymentMethodId"); }); modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate.OrderItem", b => diff --git a/src/Services/Ordering/Ordering.Domain/AggregatesModel/BuyerAggregate/Buyer.cs b/src/Services/Ordering/Ordering.Domain/AggregatesModel/BuyerAggregate/Buyer.cs index 0203b72e3..e8a0684d3 100644 --- a/src/Services/Ordering/Ordering.Domain/AggregatesModel/BuyerAggregate/Buyer.cs +++ b/src/Services/Ordering/Ordering.Domain/AggregatesModel/BuyerAggregate/Buyer.cs @@ -10,9 +10,9 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.B { public string FullName { get; private set; } - private HashSet _payments; + private HashSet _paymentMethods; - public IEnumerable Payments => _payments?.ToList().AsEnumerable(); + public IEnumerable PaymentMethods => _paymentMethods?.ToList().AsEnumerable(); protected Buyer() { } @@ -25,12 +25,12 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.B FullName = identity; - _payments = new HashSet(); + _paymentMethods = new HashSet(); } - public Payment AddPayment(int cardTypeId, string alias, string cardNumber, string securityNumber, string cardHolderName, DateTime expiration) + public PaymentMethod AddPaymentMethod(int cardTypeId, string alias, string cardNumber, string securityNumber, string cardHolderName, DateTime expiration) { - var existingPayment = Payments.Where(p => p.IsEqualTo(cardTypeId, cardNumber, expiration)) + var existingPayment = _paymentMethods.Where(p => p.IsEqualTo(cardTypeId, cardNumber, expiration)) .SingleOrDefault(); if (existingPayment != null) @@ -39,9 +39,9 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.B } else { - var payment = new Payment(cardTypeId, alias, cardNumber, securityNumber, cardHolderName, expiration); + var payment = new PaymentMethod(cardTypeId, alias, cardNumber, securityNumber, cardHolderName, expiration); - _payments.Add(payment); + _paymentMethods.Add(payment); return payment; } diff --git a/src/Services/Ordering/Ordering.Domain/AggregatesModel/BuyerAggregate/Payment.cs b/src/Services/Ordering/Ordering.Domain/AggregatesModel/BuyerAggregate/Payment.cs index 5cf02e8b5..dc6af27b0 100644 --- a/src/Services/Ordering/Ordering.Domain/AggregatesModel/BuyerAggregate/Payment.cs +++ b/src/Services/Ordering/Ordering.Domain/AggregatesModel/BuyerAggregate/Payment.cs @@ -3,7 +3,7 @@ using System; namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate { - public class Payment + public class PaymentMethod : Entity { private int _buyerId; @@ -17,9 +17,9 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.B public CardType CardType { get; private set; } - protected Payment() { } + protected PaymentMethod() { } - public Payment(int cardTypeId, string alias, string cardNumber, string securityNumber, string cardHolderName, DateTime expiration) + public PaymentMethod(int cardTypeId, string alias, string cardNumber, string securityNumber, string cardHolderName, DateTime expiration) { if (String.IsNullOrWhiteSpace(cardNumber)) { diff --git a/src/Services/Ordering/Ordering.Domain/AggregatesModel/OrderAggregate/IOrderRepository.cs b/src/Services/Ordering/Ordering.Domain/AggregatesModel/OrderAggregate/IOrderRepository.cs index c7af790eb..39e2f6466 100644 --- a/src/Services/Ordering/Ordering.Domain/AggregatesModel/OrderAggregate/IOrderRepository.cs +++ b/src/Services/Ordering/Ordering.Domain/AggregatesModel/OrderAggregate/IOrderRepository.cs @@ -1,8 +1,7 @@ using Microsoft.eShopOnContainers.Services.Ordering.Domain.SeedWork; namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate -{ - +{ //This is just the RepositoryContracts or Interface defined at the Domain Layer //as requisite for the Order Aggregate public interface IOrderRepository diff --git a/src/Services/Ordering/Ordering.Domain/AggregatesModel/OrderAggregate/Order.cs b/src/Services/Ordering/Ordering.Domain/AggregatesModel/OrderAggregate/Order.cs index e1e44fcf0..344b154cd 100644 --- a/src/Services/Ordering/Ordering.Domain/AggregatesModel/OrderAggregate/Order.cs +++ b/src/Services/Ordering/Ordering.Domain/AggregatesModel/OrderAggregate/Order.cs @@ -9,7 +9,6 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.O public class Order : Entity { - private string _street; private string _city; private string _state; @@ -26,16 +25,16 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.O HashSet _orderItems; public IEnumerable OrderItems => _orderItems.ToList().AsEnumerable(); - public Payment Payment { get; private set; } - int _paymentId; + public PaymentMethod PaymentMethod { get; private set; } + int _paymentMethodId; protected Order() { } - public Order(int buyerId, int paymentId, Address address) + public Order(int buyerId, int paymentMethodId, Address address) { _buyerId = buyerId; - _paymentId = paymentId; + _paymentMethodId = paymentMethodId; _orderStatusId = OrderStatus.InProcess.Id; _orderDate = DateTime.UtcNow; _street = address.Street; diff --git a/src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs b/src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs index ac21ae53e..87449d90c 100644 --- a/src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs +++ b/src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs @@ -18,7 +18,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure public DbSet OrderItems { get; set; } - public DbSet Payments { get; set; } + public DbSet Payments { get; set; } public DbSet Buyers { get; set; } @@ -31,7 +31,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity(ConfigureBuyer); - modelBuilder.Entity(ConfigurePayment); + modelBuilder.Entity(ConfigurePayment); modelBuilder.Entity(ConfigureOrder); modelBuilder.Entity(ConfigureOrderItems); modelBuilder.Entity(ConfigureCardTypes); @@ -54,18 +54,19 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure buyerConfiguration.HasIndex("FullName") .IsUnique(true); - buyerConfiguration.HasMany(b => b.Payments) + buyerConfiguration.HasMany(b => b.PaymentMethods) .WithOne() .HasForeignKey("BuyerId") .OnDelete(DeleteBehavior.Cascade); - var navigation = buyerConfiguration.Metadata.FindNavigation(nameof(Buyer.Payments)); + var navigation = buyerConfiguration.Metadata.FindNavigation(nameof(Buyer.PaymentMethods)); + navigation.SetPropertyAccessMode(PropertyAccessMode.Field); } - void ConfigurePayment(EntityTypeBuilder paymentConfiguration) + void ConfigurePayment(EntityTypeBuilder paymentConfiguration) { - paymentConfiguration.ToTable("payments", DEFAULT_SCHEMA); + paymentConfiguration.ToTable("paymentmethods", DEFAULT_SCHEMA); paymentConfiguration.HasKey(b => b.Id); @@ -112,17 +113,18 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure orderConfiguration.Property("State").IsRequired(); orderConfiguration.Property("City").IsRequired(); orderConfiguration.Property("ZipCode").IsRequired(); + orderConfiguration.Property("Country").IsRequired(); orderConfiguration.Property("BuyerId").IsRequired(); orderConfiguration.Property("OrderStatusId").IsRequired(); - orderConfiguration.Property("PaymentId").IsRequired(); + orderConfiguration.Property("PaymentMethodId").IsRequired(); var navigation = orderConfiguration.Metadata.FindNavigation(nameof(Order.OrderItems)); navigation.SetPropertyAccessMode(PropertyAccessMode.Field); - orderConfiguration.HasOne(o => o.Payment) + orderConfiguration.HasOne(o => o.PaymentMethod) .WithMany() - .HasForeignKey("PaymentId") + .HasForeignKey("PaymentMethodId") .OnDelete(DeleteBehavior.Restrict); orderConfiguration.HasOne(o => o.Buyer) @@ -160,6 +162,9 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure orderItemConfiguration.Property("Units") .IsRequired(); + + orderItemConfiguration.Property("PictureUrl") + .IsRequired(false); } void ConfigureOrderStatus(EntityTypeBuilder orderStatusConfiguration) diff --git a/src/Services/Ordering/Ordering.Infrastructure/Repositories/BuyerRepository.cs b/src/Services/Ordering/Ordering.Infrastructure/Repositories/BuyerRepository.cs index 2854e42e1..c9fdb28a6 100644 --- a/src/Services/Ordering/Ordering.Infrastructure/Repositories/BuyerRepository.cs +++ b/src/Services/Ordering/Ordering.Infrastructure/Repositories/BuyerRepository.cs @@ -48,7 +48,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositor public async Task FindAsync(string identity) { var buyer = await _context.Buyers - .Include(b => b.Payments) + .Include(b => b.PaymentMethods) .Where(b => b.FullName == identity) .SingleOrDefaultAsync();