Refactored namespaces for ordering.infrastructure project

This commit is contained in:
Sumit Ghosh 2021-10-09 17:39:07 +05:30
parent 0c52323f8d
commit c007047291
13 changed files with 437 additions and 525 deletions

View File

@ -1,10 +1,5 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate;
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure;
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.EntityConfigurations;
namespace Ordering.Infrastructure.EntityConfigurations
{
class BuyerEntityTypeConfiguration
: IEntityTypeConfiguration<Buyer>
{
@ -38,4 +33,3 @@ namespace Ordering.Infrastructure.EntityConfigurations
navigation.SetPropertyAccessMode(PropertyAccessMode.Field);
}
}
}

View File

@ -1,10 +1,5 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate;
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure;
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.EntityConfigurations;
namespace Ordering.Infrastructure.EntityConfigurations
{
class CardTypeEntityTypeConfiguration
: IEntityTypeConfiguration<CardType>
{
@ -24,4 +19,3 @@ namespace Ordering.Infrastructure.EntityConfigurations
.IsRequired();
}
}
}

View File

@ -1,10 +1,5 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure;
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency;
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.EntityConfigurations;
namespace Ordering.Infrastructure.EntityConfigurations
{
class ClientRequestEntityTypeConfiguration
: IEntityTypeConfiguration<ClientRequest>
{
@ -16,4 +11,3 @@ namespace Ordering.Infrastructure.EntityConfigurations
requestConfiguration.Property(cr => cr.Time).IsRequired();
}
}
}

View File

@ -1,12 +1,5 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure;
using System;
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.EntityConfigurations;
namespace Ordering.Infrastructure.EntityConfigurations
{
class OrderEntityTypeConfiguration : IEntityTypeConfiguration<Order>
{
public void Configure(EntityTypeBuilder<Order> orderConfiguration)
@ -83,4 +76,3 @@ namespace Ordering.Infrastructure.EntityConfigurations
.HasForeignKey("_orderStatusId");
}
}
}

View File

@ -1,10 +1,5 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure;
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.EntityConfigurations;
namespace Ordering.Infrastructure.EntityConfigurations
{
class OrderItemEntityTypeConfiguration
: IEntityTypeConfiguration<OrderItem>
{
@ -56,4 +51,3 @@ namespace Ordering.Infrastructure.EntityConfigurations
.IsRequired(false);
}
}
}

View File

@ -1,10 +1,5 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure;
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.EntityConfigurations;
namespace Ordering.Infrastructure.EntityConfigurations
{
class OrderStatusEntityTypeConfiguration
: IEntityTypeConfiguration<OrderStatus>
{
@ -24,4 +19,3 @@ namespace Ordering.Infrastructure.EntityConfigurations
.IsRequired();
}
}
}

View File

@ -1,11 +1,5 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate;
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure;
using System;
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.EntityConfigurations;
namespace Ordering.Infrastructure.EntityConfigurations
{
class PaymentMethodEntityTypeConfiguration
: IEntityTypeConfiguration<PaymentMethod>
{
@ -62,4 +56,3 @@ namespace Ordering.Infrastructure.EntityConfigurations
.HasForeignKey("_cardTypeId");
}
}
}

View File

@ -1,11 +1,8 @@
using System;
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency;
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency
{
public class ClientRequest
{
public Guid Id { get; set; }
public string Name { get; set; }
public DateTime Time { get; set; }
}
}

View File

@ -1,12 +1,8 @@
using System;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency;
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency
{
public interface IRequestManager
{
Task<bool> ExistAsync(Guid id);
Task CreateRequestForCommandAsync<T>(Guid id);
}
}

View File

@ -1,9 +1,5 @@
using Ordering.Domain.Exceptions;
using System;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency;
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency
{
public class RequestManager : IRequestManager
{
private readonly OrderingContext _context;
@ -40,4 +36,3 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempoten
await _context.SaveChangesAsync();
}
}
}

View File

@ -1,19 +1,5 @@
using MediatR;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.Seedwork;
using Ordering.Infrastructure;
using Ordering.Infrastructure.EntityConfigurations;
using System;
using System.Data;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure;
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure
{
public class OrderingContext : DbContext, IUnitOfWork
{
public const string DEFAULT_SCHEMA = "ordering";
@ -153,4 +139,3 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure
}
}
}
}

View File

@ -1,12 +1,5 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.Seedwork;
using System;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositories;
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositories
{
public class BuyerRepository
: IBuyerRepository
{
@ -65,4 +58,3 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositor
return buyer;
}
}
}

View File

@ -1,12 +1,5 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.Seedwork;
using System;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositories;
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositories
{
public class OrderRepository
: IOrderRepository
{
@ -60,4 +53,3 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositor
_context.Entry(order).State = EntityState.Modified;
}
}
}