Minor clean-up on Entity, Domain Events.
This commit is contained in:
parent
a88fbf339f
commit
d2f7d6a5d6
@ -178,16 +178,16 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.O
|
||||
private void AddOrderStartedDomainEvent(string userId, int cardTypeId, string cardNumber,
|
||||
string cardSecurityNumber, string cardHolderName, DateTime cardExpiration)
|
||||
{
|
||||
var orderStartedDomainEvent = new OrderStartedDomainEvent(
|
||||
this, userId, cardTypeId, cardNumber, cardSecurityNumber,
|
||||
cardHolderName, cardExpiration);
|
||||
var orderStartedDomainEvent = new OrderStartedDomainEvent(this, userId, cardTypeId,
|
||||
cardNumber, cardSecurityNumber,
|
||||
cardHolderName, cardExpiration);
|
||||
|
||||
this.AddDomainEvent(orderStartedDomainEvent);
|
||||
}
|
||||
|
||||
private void StatusChangeException(OrderStatus orderStatusToChange)
|
||||
{
|
||||
throw new OrderingDomainException($"Not possible to change order status from {OrderStatus.Name} to {orderStatusToChange.Name}.");
|
||||
throw new OrderingDomainException($"Is not possible to change the order status from {OrderStatus.Name} to {orderStatusToChange.Name}.");
|
||||
}
|
||||
|
||||
public decimal GetTotal()
|
||||
|
@ -9,8 +9,7 @@ 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; }
|
||||
@ -21,9 +20,9 @@ namespace Ordering.Domain.Events
|
||||
public Order Order { get; private set; }
|
||||
|
||||
public OrderStartedDomainEvent(Order order, string userId,
|
||||
int cardTypeId, string cardNumber,
|
||||
string cardSecurityNumber, string cardHolderName,
|
||||
DateTime cardExpiration)
|
||||
int cardTypeId, string cardNumber,
|
||||
string cardSecurityNumber, string cardHolderName,
|
||||
DateTime cardExpiration)
|
||||
{
|
||||
Order = order;
|
||||
UserId = userId;
|
||||
|
@ -21,7 +21,8 @@
|
||||
}
|
||||
|
||||
private List<INotification> _domainEvents;
|
||||
public List<INotification> DomainEvents => _domainEvents;
|
||||
public List<INotification> DomainEvents => _domainEvents;
|
||||
|
||||
public void AddDomainEvent(INotification eventItem)
|
||||
{
|
||||
_domainEvents = _domainEvents ?? new List<INotification>();
|
||||
|
@ -12,7 +12,7 @@ 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; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user