Minor clean-up on Entity, Domain Events.

This commit is contained in:
Cesar De la Torre 2017-11-07 16:53:41 -08:00
parent a88fbf339f
commit d2f7d6a5d6
4 changed files with 11 additions and 11 deletions

View File

@ -178,8 +178,8 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.O
private void AddOrderStartedDomainEvent(string userId, int cardTypeId, string cardNumber, 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( var orderStartedDomainEvent = new OrderStartedDomainEvent(this, userId, cardTypeId,
this, userId, cardTypeId, cardNumber, cardSecurityNumber, cardNumber, cardSecurityNumber,
cardHolderName, cardExpiration); cardHolderName, cardExpiration);
this.AddDomainEvent(orderStartedDomainEvent); this.AddDomainEvent(orderStartedDomainEvent);
@ -187,7 +187,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.O
private void StatusChangeException(OrderStatus orderStatusToChange) 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() public decimal GetTotal()

View File

@ -9,8 +9,7 @@ namespace Ordering.Domain.Events
/// <summary> /// <summary>
/// Event used when an order is created /// Event used when an order is created
/// </summary> /// </summary>
public class OrderStartedDomainEvent public class OrderStartedDomainEvent : INotification
: INotification
{ {
public string UserId { get; private set; } public string UserId { get; private set; }
public int CardTypeId { get; private set; } public int CardTypeId { get; private set; }

View File

@ -22,6 +22,7 @@
private List<INotification> _domainEvents; private List<INotification> _domainEvents;
public List<INotification> DomainEvents => _domainEvents; public List<INotification> DomainEvents => _domainEvents;
public void AddDomainEvent(INotification eventItem) public void AddDomainEvent(INotification eventItem)
{ {
_domainEvents = _domainEvents ?? new List<INotification>(); _domainEvents = _domainEvents ?? new List<INotification>();

View File

@ -12,7 +12,7 @@ using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure
{ {
public class OrderingContext : DbContext,IUnitOfWork public class OrderingContext : DbContext, IUnitOfWork
{ {
public const string DEFAULT_SCHEMA = "ordering"; public const string DEFAULT_SCHEMA = "ordering";
public DbSet<Order> Orders { get; set; } public DbSet<Order> Orders { get; set; }