Refactoring in Ordering Domain Model so it shows a clear AggregateModel and clusters of entities as Aggregates.
Also, showing Repository Interfaces as RepositoryContracts.
This commit is contained in:
parent
d09bffd294
commit
57ae6ab3be
@ -6,10 +6,15 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
//(CDLTLL) TO DO: This is wrong, we must NOT use a child-entity class within a Command class!!
|
||||
//Need to create a different DTO class, like OrderLineDTO or similar...
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
|
||||
|
||||
public class NewOrderCommand
|
||||
:IAsyncRequest<bool>
|
||||
{
|
||||
|
||||
//(CDLTLL) TO DO: This is wrong, we must NOT use a child-entity class within a Command class!!
|
||||
//Need to create a different DTO class, like OrderLineDTO or similar...
|
||||
private readonly List<OrderItem> _orderItems;
|
||||
public string City { get; set; }
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Api.Application.Commands
|
||||
{
|
||||
using Domain.Repositories;
|
||||
using Domain.RepositoryContracts;
|
||||
using Domain.AggregatesModel.OrderAggregate;
|
||||
using Domain.AggregatesModel.BuyerAggregate;
|
||||
using MediatR;
|
||||
using System.Linq;
|
||||
using System;
|
||||
@ -84,7 +86,7 @@
|
||||
|
||||
}
|
||||
|
||||
Payment PaymentAlreadyExist(Domain.Buyer buyer, NewOrderCommand message)
|
||||
Payment PaymentAlreadyExist(Buyer buyer, NewOrderCommand message)
|
||||
{
|
||||
return buyer.Payments
|
||||
.SingleOrDefault(p =>
|
||||
|
@ -4,7 +4,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Autof
|
||||
{
|
||||
using Api.Application.Queries;
|
||||
using Autofac;
|
||||
using Domain.Repositories;
|
||||
using Domain.RepositoryContracts;
|
||||
using Ordering.Infrastructure.Repositories;
|
||||
|
||||
public class ApplicationModule
|
||||
|
@ -6,6 +6,8 @@
|
||||
using Ordering.Infrastructure;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
|
||||
|
||||
public class OrderingContextSeed
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Domain
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate
|
||||
{
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.SeedWork;
|
||||
using System;
|
@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Domain
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate
|
||||
{
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.SeedWork;
|
||||
using System;
|
@ -1,4 +1,4 @@
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Domain
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate
|
||||
{
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.SeedWork;
|
||||
using System;
|
@ -1,4 +1,4 @@
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Domain
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate
|
||||
{
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.SeedWork;
|
||||
using System;
|
@ -1,6 +1,7 @@
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Domain
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate
|
||||
{
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.SeedWork;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Domain
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate
|
||||
{
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.SeedWork;
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Domain
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate
|
||||
{
|
||||
using SeedWork;
|
||||
using System;
|
@ -1,7 +1,8 @@
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.SeedWork;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.Repositories
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.RepositoryContracts
|
||||
{
|
||||
public interface IBuyerRepository
|
||||
:IRepository
|
@ -1,6 +1,7 @@
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.Repositories
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.RepositoryContracts
|
||||
{
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.SeedWork;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
|
||||
|
||||
public interface IOrderRepository
|
||||
:IRepository
|
@ -7,6 +7,8 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
|
||||
|
||||
public class OrderingContext
|
||||
: DbContext,IUnitOfWork
|
||||
|
@ -3,7 +3,8 @@
|
||||
using Domain.SeedWork;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.Repositories;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.RepositoryContracts;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -2,7 +2,8 @@
|
||||
{
|
||||
using Domain;
|
||||
using Domain.SeedWork;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.Repositories;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.RepositoryContracts;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
|
||||
using System;
|
||||
|
||||
public class OrderRepository
|
||||
|
Loading…
x
Reference in New Issue
Block a user