Merge d4cca7440eb3f94069bc97102be0f0262049ba02 into 4267d24a3d44bff953d29646d183adf0e797fc0e
This commit is contained in:
commit
e8b1ee8256
@ -26,20 +26,18 @@
|
||||
|
||||
await policy.ExecuteAsync(async () =>
|
||||
{
|
||||
|
||||
var useCustomizationData = settings.Value
|
||||
.UseCustomizationData;
|
||||
|
||||
var contentRootPath = env.ContentRootPath;
|
||||
|
||||
|
||||
using (context)
|
||||
{
|
||||
context.Database.Migrate();
|
||||
|
||||
if (!context.CardTypes.Any())
|
||||
{
|
||||
context.CardTypes.AddRange(useCustomizationData
|
||||
await context.CardTypes.AddRangeAsync(useCustomizationData
|
||||
? GetCardTypesFromFile(contentRootPath, logger)
|
||||
: GetPredefinedCardTypes());
|
||||
|
||||
@ -48,7 +46,7 @@
|
||||
|
||||
if (!context.OrderStatus.Any())
|
||||
{
|
||||
context.OrderStatus.AddRange(useCustomizationData
|
||||
await context.OrderStatus.AddRangeAsync(useCustomizationData
|
||||
? GetOrderStatusFromFile(contentRootPath, logger)
|
||||
: GetPredefinedOrderStatus());
|
||||
}
|
||||
|
@ -7,16 +7,16 @@ using System.Linq;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate
|
||||
{
|
||||
public class Buyer
|
||||
: Entity, IAggregateRoot
|
||||
: Entity, IAggregateRoot
|
||||
{
|
||||
public string IdentityGuid { get; private set; }
|
||||
|
||||
private List<PaymentMethod> _paymentMethods;
|
||||
private List<PaymentMethod> _paymentMethods;
|
||||
|
||||
public IEnumerable<PaymentMethod> PaymentMethods => _paymentMethods.AsReadOnly();
|
||||
|
||||
protected Buyer() {
|
||||
|
||||
protected Buyer()
|
||||
{
|
||||
_paymentMethods = new List<PaymentMethod>();
|
||||
}
|
||||
|
||||
@ -29,8 +29,8 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.B
|
||||
int cardTypeId, string alias, string cardNumber,
|
||||
string securityNumber, string cardHolderName, DateTime expiration, int orderId)
|
||||
{
|
||||
var existingPayment = _paymentMethods.Where(p => p.IsEqualTo(cardTypeId, cardNumber, expiration))
|
||||
.SingleOrDefault();
|
||||
var existingPayment = _paymentMethods
|
||||
.SingleOrDefault(p => p.IsEqualTo(cardTypeId, cardNumber, expiration));
|
||||
|
||||
if (existingPayment != null)
|
||||
{
|
||||
|
@ -5,20 +5,18 @@ using System.Linq;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate
|
||||
{
|
||||
|
||||
public class CardType
|
||||
: Enumeration
|
||||
{
|
||||
public static CardType Amex = new CardType(1, "Amex");
|
||||
public static CardType Visa = new CardType(2, "Visa");
|
||||
public static CardType MasterCard = new CardType(3, "MasterCard");
|
||||
public static readonly CardType Amex = new CardType(1, "Amex");
|
||||
public static readonly CardType Visa = new CardType(2, "Visa");
|
||||
public static readonly CardType MasterCard = new CardType(3, "MasterCard");
|
||||
|
||||
protected CardType() { }
|
||||
|
||||
public CardType(int id, string name)
|
||||
: base(id, name)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static IEnumerable<CardType> List()
|
||||
@ -33,7 +31,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.B
|
||||
|
||||
if (state == null)
|
||||
{
|
||||
throw new ArgumentException($"Possible values for CardType: {String.Join(",", List().Select(s => s.Name))}");
|
||||
throw new ArgumentException($"Possible values for CardType: {string.Join(",", List().Select(s => s.Name))}");
|
||||
}
|
||||
|
||||
return state;
|
||||
|
@ -6,10 +6,11 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.B
|
||||
//This is just the RepositoryContracts or Interface defined at the Domain Layer
|
||||
//as requisite for the Buyer Aggregate
|
||||
|
||||
public interface IBuyerRepository : IRepository<Buyer>
|
||||
public interface IBuyerRepository
|
||||
: IRepository<Buyer>
|
||||
{
|
||||
Buyer Add(Buyer buyer);
|
||||
Buyer Update(Buyer buyer);
|
||||
Task<Buyer> FindAsync(string BuyerIdentityGuid);
|
||||
Task<Buyer> FindAsync(string buyerIdentityGuid);
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.B
|
||||
|
||||
public PaymentMethod(int cardTypeId, string alias, string cardNumber, string securityNumber, string cardHolderName, DateTime expiration)
|
||||
{
|
||||
|
||||
_cardNumber = !string.IsNullOrWhiteSpace(cardNumber) ? cardNumber : throw new OrderingDomainException(nameof(cardNumber));
|
||||
_securityNumber = !string.IsNullOrWhiteSpace(securityNumber) ? securityNumber : throw new OrderingDomainException(nameof(securityNumber));
|
||||
_cardHolderName = !string.IsNullOrWhiteSpace(cardHolderName) ? cardHolderName : throw new OrderingDomainException(nameof(cardHolderName));
|
||||
|
@ -4,7 +4,8 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate
|
||||
{
|
||||
public class Address : ValueObject
|
||||
public class Address
|
||||
: ValueObject
|
||||
{
|
||||
public String Street { get; private set; }
|
||||
public String City { get; private set; }
|
||||
|
@ -6,12 +6,11 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.O
|
||||
//This is just the RepositoryContracts or Interface defined at the Domain Layer
|
||||
//as requisite for the Order Aggregate
|
||||
|
||||
public interface IOrderRepository : IRepository<Order>
|
||||
public interface IOrderRepository
|
||||
: IRepository<Order>
|
||||
{
|
||||
Order Add(Order order);
|
||||
|
||||
void Update(Order order);
|
||||
|
||||
Task<Order> GetAsync(int orderId);
|
||||
}
|
||||
}
|
||||
|
@ -34,10 +34,13 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.O
|
||||
|
||||
private int? _paymentMethodId;
|
||||
|
||||
protected Order() { _orderItems = new List<OrderItem>(); }
|
||||
protected Order()
|
||||
{
|
||||
_orderItems = new List<OrderItem>();
|
||||
}
|
||||
|
||||
public Order(string userId, Address address, int cardTypeId, string cardNumber, string cardSecurityNumber,
|
||||
string cardHolderName, DateTime cardExpiration, int? buyerId = null, int? paymentMethodId = null)
|
||||
string cardHolderName, DateTime cardExpiration, int? buyerId = null, int? paymentMethodId = null)
|
||||
{
|
||||
_orderItems = new List<OrderItem>();
|
||||
_buyerId = buyerId;
|
||||
@ -58,8 +61,8 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.O
|
||||
// in order to maintain consistency between the whole Aggregate.
|
||||
public void AddOrderItem(int productId, string productName, decimal unitPrice, decimal discount, string pictureUrl, int units = 1)
|
||||
{
|
||||
var existingOrderForProduct = _orderItems.Where(o => o.ProductId == productId)
|
||||
.SingleOrDefault();
|
||||
var existingOrderForProduct = _orderItems
|
||||
.SingleOrDefault(o => o.ProductId == productId);
|
||||
|
||||
if (existingOrderForProduct != null)
|
||||
{
|
||||
@ -92,12 +95,12 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.O
|
||||
}
|
||||
|
||||
public void SetAwaitingValidationStatus()
|
||||
{
|
||||
{
|
||||
if (_orderStatusId == OrderStatus.Submitted.Id)
|
||||
{
|
||||
AddDomainEvent(new OrderStatusChangedToAwaitingValidationDomainEvent(Id, _orderItems));
|
||||
_orderStatusId = OrderStatus.AwaitingValidation.Id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetStockConfirmedStatus()
|
||||
@ -157,11 +160,11 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.O
|
||||
|
||||
var itemsStockRejectedDescription = string.Join(", ", itemsStockRejectedProductNames);
|
||||
_description = $"The product items don't have stock: ({itemsStockRejectedDescription}).";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AddOrderStartedDomainEvent(string userId, int cardTypeId, string cardNumber,
|
||||
string cardSecurityNumber, string cardHolderName, DateTime cardExpiration)
|
||||
string cardSecurityNumber, string cardHolderName, DateTime cardExpiration)
|
||||
{
|
||||
var orderStartedDomainEvent = new OrderStartedDomainEvent(this, userId, cardTypeId,
|
||||
cardNumber, cardSecurityNumber,
|
||||
@ -180,5 +183,4 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.O
|
||||
return _orderItems.Sum(o => o.GetUnits() * o.GetUnitPrice());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.Seedwork;
|
||||
using Ordering.Domain.Exceptions;
|
||||
using System;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate
|
||||
{
|
||||
@ -20,7 +19,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.O
|
||||
|
||||
protected OrderItem() { }
|
||||
|
||||
public OrderItem(int productId, string productName, decimal unitPrice, decimal discount, string PictureUrl, int units = 1)
|
||||
public OrderItem(int productId, string productName, decimal unitPrice, decimal discount, string pictureUrl, int units = 1)
|
||||
{
|
||||
if (units <= 0)
|
||||
{
|
||||
@ -38,12 +37,12 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.O
|
||||
_unitPrice = unitPrice;
|
||||
_discount = discount;
|
||||
_units = units;
|
||||
_pictureUrl = PictureUrl;
|
||||
_pictureUrl = pictureUrl;
|
||||
}
|
||||
|
||||
public void SetPictureUri(string pictureUri)
|
||||
{
|
||||
if (!String.IsNullOrWhiteSpace(pictureUri))
|
||||
if (!string.IsNullOrWhiteSpace(pictureUri))
|
||||
{
|
||||
_pictureUrl = pictureUri;
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate
|
||||
{
|
||||
using global::Ordering.Domain.Exceptions;
|
||||
using Seedwork;
|
||||
using SeedWork;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -17,9 +16,7 @@
|
||||
public static OrderStatus Shipped = new OrderStatus(5, nameof(Shipped).ToLowerInvariant());
|
||||
public static OrderStatus Cancelled = new OrderStatus(6, nameof(Cancelled).ToLowerInvariant());
|
||||
|
||||
protected OrderStatus()
|
||||
{
|
||||
}
|
||||
protected OrderStatus() { }
|
||||
|
||||
public OrderStatus(int id, string name)
|
||||
: base(id, name)
|
||||
@ -32,11 +29,11 @@
|
||||
public static OrderStatus FromName(string name)
|
||||
{
|
||||
var state = List()
|
||||
.SingleOrDefault(s => String.Equals(s.Name, name, StringComparison.CurrentCultureIgnoreCase));
|
||||
.SingleOrDefault(s => string.Equals(s.Name, name, StringComparison.CurrentCultureIgnoreCase));
|
||||
|
||||
if (state == null)
|
||||
{
|
||||
throw new OrderingDomainException($"Possible values for OrderStatus: {String.Join(",", List().Select(s => s.Name))}");
|
||||
throw new OrderingDomainException($"Possible values for OrderStatus: {string.Join(",", List().Select(s => s.Name))}");
|
||||
}
|
||||
|
||||
return state;
|
||||
@ -48,7 +45,7 @@
|
||||
|
||||
if (state == null)
|
||||
{
|
||||
throw new OrderingDomainException($"Possible values for OrderStatus: {String.Join(",", List().Select(s => s.Name))}");
|
||||
throw new OrderingDomainException($"Possible values for OrderStatus: {string.Join(",", List().Select(s => s.Name))}");
|
||||
}
|
||||
|
||||
return state;
|
||||
|
@ -1,15 +1,14 @@
|
||||
using MediatR;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Ordering.Domain.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Event used when an order is created
|
||||
/// </summary>
|
||||
public class OrderStartedDomainEvent : INotification
|
||||
public class OrderStartedDomainEvent
|
||||
: INotification
|
||||
{
|
||||
public string UserId { get; private set; }
|
||||
public int CardTypeId { get; private set; }
|
||||
|
@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Ordering.Domain.Exceptions
|
||||
{
|
||||
|
@ -1,33 +1,27 @@
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.Seedwork
|
||||
{
|
||||
using System;
|
||||
using MediatR;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public abstract class Entity
|
||||
{
|
||||
int? _requestedHashCode;
|
||||
int _Id;
|
||||
int _Id;
|
||||
public virtual int Id
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Id;
|
||||
}
|
||||
protected set
|
||||
{
|
||||
_Id = value;
|
||||
}
|
||||
get => _Id;
|
||||
protected set => _Id = value;
|
||||
}
|
||||
|
||||
private List<INotification> _domainEvents;
|
||||
public List<INotification> DomainEvents => _domainEvents;
|
||||
|
||||
|
||||
public void AddDomainEvent(INotification eventItem)
|
||||
{
|
||||
_domainEvents = _domainEvents ?? new List<INotification>();
|
||||
_domainEvents.Add(eventItem);
|
||||
}
|
||||
|
||||
public void RemoveDomainEvent(INotification eventItem)
|
||||
{
|
||||
if (_domainEvents is null) return;
|
||||
@ -36,15 +30,15 @@
|
||||
|
||||
public bool IsTransient()
|
||||
{
|
||||
return this.Id == default(Int32);
|
||||
return this.Id == default(int);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj == null || !(obj is Entity))
|
||||
if (!(obj is Entity))
|
||||
return false;
|
||||
|
||||
if (Object.ReferenceEquals(this, obj))
|
||||
if (object.ReferenceEquals(this, obj))
|
||||
return true;
|
||||
|
||||
if (this.GetType() != obj.GetType())
|
||||
@ -53,9 +47,13 @@
|
||||
Entity item = (Entity)obj;
|
||||
|
||||
if (item.IsTransient() || this.IsTransient())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return item.Id == this.Id;
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
@ -63,20 +61,27 @@
|
||||
if (!IsTransient())
|
||||
{
|
||||
if (!_requestedHashCode.HasValue)
|
||||
{
|
||||
_requestedHashCode = this.Id.GetHashCode() ^ 31; // XOR for random distribution (http://blogs.msdn.com/b/ericlippert/archive/2011/02/28/guidelines-and-rules-for-gethashcode.aspx)
|
||||
}
|
||||
|
||||
return _requestedHashCode.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return base.GetHashCode();
|
||||
|
||||
}
|
||||
}
|
||||
public static bool operator ==(Entity left, Entity right)
|
||||
{
|
||||
if (Object.Equals(left, null))
|
||||
return (Object.Equals(right, null)) ? true : false;
|
||||
if (object.Equals(left, null))
|
||||
{
|
||||
return object.Equals(right, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
return left.Equals(right);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool operator !=(Entity left, Entity right)
|
||||
|
@ -5,15 +5,14 @@ using System.Reflection;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.SeedWork
|
||||
{
|
||||
public abstract class Enumeration : IComparable
|
||||
public abstract class Enumeration
|
||||
: IComparable
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
|
||||
public int Id { get; private set; }
|
||||
|
||||
protected Enumeration()
|
||||
{
|
||||
}
|
||||
protected Enumeration() { }
|
||||
|
||||
protected Enumeration(int id, string name)
|
||||
{
|
||||
@ -34,9 +33,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.SeedWork
|
||||
foreach (var info in fields)
|
||||
{
|
||||
var instance = new T();
|
||||
var locatedValue = info.GetValue(instance) as T;
|
||||
|
||||
if (locatedValue != null)
|
||||
if (info.GetValue(instance) is T locatedValue)
|
||||
{
|
||||
yield return locatedValue;
|
||||
}
|
||||
@ -45,9 +42,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.SeedWork
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var otherValue = obj as Enumeration;
|
||||
|
||||
if (otherValue == null)
|
||||
if (!(obj is Enumeration otherValue))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.Seedwork
|
||||
{
|
||||
|
||||
public interface IAggregateRoot { }
|
||||
|
||||
}
|
||||
|
@ -4,8 +4,9 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.Seedwork
|
||||
{
|
||||
public interface IUnitOfWork : IDisposable
|
||||
{
|
||||
public interface IUnitOfWork
|
||||
: IDisposable
|
||||
{
|
||||
Task<int> SaveChangesAsync(CancellationToken cancellationToken = default(CancellationToken));
|
||||
Task<bool> SaveEntitiesAsync(CancellationToken cancellationToken = default(CancellationToken));
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.SeedWork
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ValueObject other = (ValueObject)obj;
|
||||
IEnumerator<object> thisValues = GetAtomicValues().GetEnumerator();
|
||||
IEnumerator<object> otherValues = other.GetAtomicValues().GetEnumerator();
|
||||
|
@ -24,7 +24,7 @@ namespace Ordering.Infrastructure.EntityConfigurations
|
||||
.IsRequired();
|
||||
|
||||
buyerConfiguration.HasIndex("IdentityGuid")
|
||||
.IsUnique(true);
|
||||
.IsUnique();
|
||||
|
||||
buyerConfiguration.HasMany(b => b.PaymentMethods)
|
||||
.WithOne()
|
||||
|
@ -4,7 +4,8 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency
|
||||
{
|
||||
public class RequestManager : IRequestManager
|
||||
public class RequestManager
|
||||
: IRequestManager
|
||||
{
|
||||
private readonly OrderingContext _context;
|
||||
|
||||
|
@ -12,7 +12,8 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure
|
||||
{
|
||||
public class OrderingContext : DbContext, IUnitOfWork
|
||||
public class OrderingContext
|
||||
: DbContext, IUnitOfWork
|
||||
{
|
||||
public const string DEFAULT_SCHEMA = "ordering";
|
||||
public DbSet<Order> Orders { get; set; }
|
||||
@ -24,13 +25,14 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure
|
||||
|
||||
private readonly IMediator _mediator;
|
||||
|
||||
private OrderingContext(DbContextOptions<OrderingContext> options) : base (options) { }
|
||||
private OrderingContext(DbContextOptions<OrderingContext> options)
|
||||
: base (options) { }
|
||||
|
||||
public OrderingContext(DbContextOptions<OrderingContext> options, IMediator mediator) : base(options)
|
||||
public OrderingContext(DbContextOptions<OrderingContext> options, IMediator mediator)
|
||||
: base(options)
|
||||
{
|
||||
_mediator = mediator ?? throw new ArgumentNullException(nameof(mediator));
|
||||
|
||||
|
||||
System.Diagnostics.Debug.WriteLine("OrderingContext::ctor ->" + this.GetHashCode());
|
||||
}
|
||||
|
||||
@ -57,13 +59,14 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure
|
||||
|
||||
// After executing this line all the changes (from the Command Handler and Domain Event Handlers)
|
||||
// performed throught the DbContext will be commited
|
||||
var result = await base.SaveChangesAsync();
|
||||
var result = await base.SaveChangesAsync(cancellationToken);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class OrderingContextDesignFactory : IDesignTimeDbContextFactory<OrderingContext>
|
||||
public class OrderingContextDesignFactory
|
||||
: IDesignTimeDbContextFactory<OrderingContext>
|
||||
{
|
||||
public OrderingContext CreateDbContext(string[] args)
|
||||
{
|
||||
@ -73,9 +76,11 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure
|
||||
return new OrderingContext(optionsBuilder.Options,new NoMediator());
|
||||
}
|
||||
|
||||
class NoMediator : IMediator
|
||||
class NoMediator
|
||||
: IMediator
|
||||
{
|
||||
public Task Publish<TNotification>(TNotification notification, CancellationToken cancellationToken = default(CancellationToken)) where TNotification : INotification
|
||||
public Task Publish<TNotification>(TNotification notification, CancellationToken cancellationToken = default(CancellationToken))
|
||||
where TNotification : INotification
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
@ -11,13 +11,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositor
|
||||
: IBuyerRepository
|
||||
{
|
||||
private readonly OrderingContext _context;
|
||||
public IUnitOfWork UnitOfWork
|
||||
{
|
||||
get
|
||||
{
|
||||
return _context;
|
||||
}
|
||||
}
|
||||
public IUnitOfWork UnitOfWork => _context;
|
||||
|
||||
public BuyerRepository(OrderingContext context)
|
||||
{
|
||||
@ -35,14 +29,14 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositor
|
||||
else
|
||||
{
|
||||
return buyer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Buyer Update(Buyer buyer)
|
||||
{
|
||||
return _context.Buyers
|
||||
.Update(buyer)
|
||||
.Entity;
|
||||
.Update(buyer)
|
||||
.Entity;
|
||||
}
|
||||
|
||||
public async Task<Buyer> FindAsync(string identity)
|
||||
|
@ -1,7 +1,6 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.Seedwork;
|
||||
using Ordering.Domain.Exceptions;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -12,13 +11,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositor
|
||||
{
|
||||
private readonly OrderingContext _context;
|
||||
|
||||
public IUnitOfWork UnitOfWork
|
||||
{
|
||||
get
|
||||
{
|
||||
return _context;
|
||||
}
|
||||
}
|
||||
public IUnitOfWork UnitOfWork => _context;
|
||||
|
||||
public OrderRepository(OrderingContext context)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user