Refactored namespaces for ordering.infrastructure project
This commit is contained in:
parent
0c52323f8d
commit
c007047291
@ -1,13 +1,8 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.EntityConfigurations;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate;
|
|
||||||
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure;
|
|
||||||
|
|
||||||
namespace Ordering.Infrastructure.EntityConfigurations
|
class BuyerEntityTypeConfiguration
|
||||||
{
|
|
||||||
class BuyerEntityTypeConfiguration
|
|
||||||
: IEntityTypeConfiguration<Buyer>
|
: IEntityTypeConfiguration<Buyer>
|
||||||
{
|
{
|
||||||
public void Configure(EntityTypeBuilder<Buyer> buyerConfiguration)
|
public void Configure(EntityTypeBuilder<Buyer> buyerConfiguration)
|
||||||
{
|
{
|
||||||
buyerConfiguration.ToTable("buyers", OrderingContext.DEFAULT_SCHEMA);
|
buyerConfiguration.ToTable("buyers", OrderingContext.DEFAULT_SCHEMA);
|
||||||
@ -37,5 +32,4 @@ namespace Ordering.Infrastructure.EntityConfigurations
|
|||||||
|
|
||||||
navigation.SetPropertyAccessMode(PropertyAccessMode.Field);
|
navigation.SetPropertyAccessMode(PropertyAccessMode.Field);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,8 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.EntityConfigurations;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate;
|
|
||||||
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure;
|
|
||||||
|
|
||||||
namespace Ordering.Infrastructure.EntityConfigurations
|
class CardTypeEntityTypeConfiguration
|
||||||
{
|
|
||||||
class CardTypeEntityTypeConfiguration
|
|
||||||
: IEntityTypeConfiguration<CardType>
|
: IEntityTypeConfiguration<CardType>
|
||||||
{
|
{
|
||||||
public void Configure(EntityTypeBuilder<CardType> cardTypesConfiguration)
|
public void Configure(EntityTypeBuilder<CardType> cardTypesConfiguration)
|
||||||
{
|
{
|
||||||
cardTypesConfiguration.ToTable("cardtypes", OrderingContext.DEFAULT_SCHEMA);
|
cardTypesConfiguration.ToTable("cardtypes", OrderingContext.DEFAULT_SCHEMA);
|
||||||
@ -23,5 +18,4 @@ namespace Ordering.Infrastructure.EntityConfigurations
|
|||||||
.HasMaxLength(200)
|
.HasMaxLength(200)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,8 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.EntityConfigurations;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure;
|
|
||||||
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency;
|
|
||||||
|
|
||||||
namespace Ordering.Infrastructure.EntityConfigurations
|
class ClientRequestEntityTypeConfiguration
|
||||||
{
|
|
||||||
class ClientRequestEntityTypeConfiguration
|
|
||||||
: IEntityTypeConfiguration<ClientRequest>
|
: IEntityTypeConfiguration<ClientRequest>
|
||||||
{
|
{
|
||||||
public void Configure(EntityTypeBuilder<ClientRequest> requestConfiguration)
|
public void Configure(EntityTypeBuilder<ClientRequest> requestConfiguration)
|
||||||
{
|
{
|
||||||
requestConfiguration.ToTable("requests", OrderingContext.DEFAULT_SCHEMA);
|
requestConfiguration.ToTable("requests", OrderingContext.DEFAULT_SCHEMA);
|
||||||
@ -15,5 +10,4 @@ namespace Ordering.Infrastructure.EntityConfigurations
|
|||||||
requestConfiguration.Property(cr => cr.Name).IsRequired();
|
requestConfiguration.Property(cr => cr.Name).IsRequired();
|
||||||
requestConfiguration.Property(cr => cr.Time).IsRequired();
|
requestConfiguration.Property(cr => cr.Time).IsRequired();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,7 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.EntityConfigurations;
|
||||||
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 Ordering.Infrastructure.EntityConfigurations
|
class OrderEntityTypeConfiguration : IEntityTypeConfiguration<Order>
|
||||||
{
|
{
|
||||||
class OrderEntityTypeConfiguration : IEntityTypeConfiguration<Order>
|
|
||||||
{
|
|
||||||
public void Configure(EntityTypeBuilder<Order> orderConfiguration)
|
public void Configure(EntityTypeBuilder<Order> orderConfiguration)
|
||||||
{
|
{
|
||||||
orderConfiguration.ToTable("orders", OrderingContext.DEFAULT_SCHEMA);
|
orderConfiguration.ToTable("orders", OrderingContext.DEFAULT_SCHEMA);
|
||||||
@ -82,5 +75,4 @@ namespace Ordering.Infrastructure.EntityConfigurations
|
|||||||
// .HasForeignKey("OrderStatusId");
|
// .HasForeignKey("OrderStatusId");
|
||||||
.HasForeignKey("_orderStatusId");
|
.HasForeignKey("_orderStatusId");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,8 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.EntityConfigurations;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
|
|
||||||
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure;
|
|
||||||
|
|
||||||
namespace Ordering.Infrastructure.EntityConfigurations
|
class OrderItemEntityTypeConfiguration
|
||||||
{
|
|
||||||
class OrderItemEntityTypeConfiguration
|
|
||||||
: IEntityTypeConfiguration<OrderItem>
|
: IEntityTypeConfiguration<OrderItem>
|
||||||
{
|
{
|
||||||
public void Configure(EntityTypeBuilder<OrderItem> orderItemConfiguration)
|
public void Configure(EntityTypeBuilder<OrderItem> orderItemConfiguration)
|
||||||
{
|
{
|
||||||
orderItemConfiguration.ToTable("orderItems", OrderingContext.DEFAULT_SCHEMA);
|
orderItemConfiguration.ToTable("orderItems", OrderingContext.DEFAULT_SCHEMA);
|
||||||
@ -55,5 +50,4 @@ namespace Ordering.Infrastructure.EntityConfigurations
|
|||||||
.HasColumnName("PictureUrl")
|
.HasColumnName("PictureUrl")
|
||||||
.IsRequired(false);
|
.IsRequired(false);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,8 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.EntityConfigurations;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
|
|
||||||
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure;
|
|
||||||
|
|
||||||
namespace Ordering.Infrastructure.EntityConfigurations
|
class OrderStatusEntityTypeConfiguration
|
||||||
{
|
|
||||||
class OrderStatusEntityTypeConfiguration
|
|
||||||
: IEntityTypeConfiguration<OrderStatus>
|
: IEntityTypeConfiguration<OrderStatus>
|
||||||
{
|
{
|
||||||
public void Configure(EntityTypeBuilder<OrderStatus> orderStatusConfiguration)
|
public void Configure(EntityTypeBuilder<OrderStatus> orderStatusConfiguration)
|
||||||
{
|
{
|
||||||
orderStatusConfiguration.ToTable("orderstatus", OrderingContext.DEFAULT_SCHEMA);
|
orderStatusConfiguration.ToTable("orderstatus", OrderingContext.DEFAULT_SCHEMA);
|
||||||
@ -23,5 +18,4 @@ namespace Ordering.Infrastructure.EntityConfigurations
|
|||||||
.HasMaxLength(200)
|
.HasMaxLength(200)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,8 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.EntityConfigurations;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate;
|
|
||||||
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure;
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Ordering.Infrastructure.EntityConfigurations
|
class PaymentMethodEntityTypeConfiguration
|
||||||
{
|
|
||||||
class PaymentMethodEntityTypeConfiguration
|
|
||||||
: IEntityTypeConfiguration<PaymentMethod>
|
: IEntityTypeConfiguration<PaymentMethod>
|
||||||
{
|
{
|
||||||
public void Configure(EntityTypeBuilder<PaymentMethod> paymentConfiguration)
|
public void Configure(EntityTypeBuilder<PaymentMethod> paymentConfiguration)
|
||||||
{
|
{
|
||||||
paymentConfiguration.ToTable("paymentmethods", OrderingContext.DEFAULT_SCHEMA);
|
paymentConfiguration.ToTable("paymentmethods", OrderingContext.DEFAULT_SCHEMA);
|
||||||
@ -61,5 +55,4 @@ namespace Ordering.Infrastructure.EntityConfigurations
|
|||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("_cardTypeId");
|
.HasForeignKey("_cardTypeId");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
using System;
|
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency;
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency
|
public class ClientRequest
|
||||||
{
|
{
|
||||||
public class ClientRequest
|
|
||||||
{
|
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public DateTime Time { get; set; }
|
public DateTime Time { get; set; }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
using System;
|
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency
|
public interface IRequestManager
|
||||||
{
|
{
|
||||||
public interface IRequestManager
|
|
||||||
{
|
|
||||||
Task<bool> ExistAsync(Guid id);
|
Task<bool> ExistAsync(Guid id);
|
||||||
|
|
||||||
Task CreateRequestForCommandAsync<T>(Guid id);
|
Task CreateRequestForCommandAsync<T>(Guid id);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
using Ordering.Domain.Exceptions;
|
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency;
|
||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency
|
public class RequestManager : IRequestManager
|
||||||
{
|
{
|
||||||
public class RequestManager : IRequestManager
|
|
||||||
{
|
|
||||||
private readonly OrderingContext _context;
|
private readonly OrderingContext _context;
|
||||||
|
|
||||||
public RequestManager(OrderingContext context)
|
public RequestManager(OrderingContext context)
|
||||||
@ -39,5 +35,4 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempoten
|
|||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,7 @@
|
|||||||
using MediatR;
|
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure;
|
||||||
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
|
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; }
|
||||||
public DbSet<OrderItem> OrderItems { get; set; }
|
public DbSet<OrderItem> OrderItems { get; set; }
|
||||||
@ -118,10 +104,10 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OrderingContextDesignFactory : IDesignTimeDbContextFactory<OrderingContext>
|
public class OrderingContextDesignFactory : IDesignTimeDbContextFactory<OrderingContext>
|
||||||
{
|
{
|
||||||
public OrderingContext CreateDbContext(string[] args)
|
public OrderingContext CreateDbContext(string[] args)
|
||||||
{
|
{
|
||||||
var optionsBuilder = new DbContextOptionsBuilder<OrderingContext>()
|
var optionsBuilder = new DbContextOptionsBuilder<OrderingContext>()
|
||||||
@ -152,5 +138,4 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure
|
|||||||
return Task.FromResult(default(object));
|
return Task.FromResult(default(object));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,8 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositories;
|
||||||
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
|
public class BuyerRepository
|
||||||
{
|
|
||||||
public class BuyerRepository
|
|
||||||
: IBuyerRepository
|
: IBuyerRepository
|
||||||
{
|
{
|
||||||
private readonly OrderingContext _context;
|
private readonly OrderingContext _context;
|
||||||
public IUnitOfWork UnitOfWork
|
public IUnitOfWork UnitOfWork
|
||||||
{
|
{
|
||||||
@ -64,5 +57,4 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositor
|
|||||||
|
|
||||||
return buyer;
|
return buyer;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,8 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositories;
|
||||||
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
|
public class OrderRepository
|
||||||
{
|
|
||||||
public class OrderRepository
|
|
||||||
: IOrderRepository
|
: IOrderRepository
|
||||||
{
|
{
|
||||||
private readonly OrderingContext _context;
|
private readonly OrderingContext _context;
|
||||||
|
|
||||||
public IUnitOfWork UnitOfWork
|
public IUnitOfWork UnitOfWork
|
||||||
@ -59,5 +52,4 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositor
|
|||||||
{
|
{
|
||||||
_context.Entry(order).State = EntityState.Modified;
|
_context.Entry(order).State = EntityState.Modified;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user