Browse Source

Moved individual usings statements to globalusing

pull/1770/head
Sumit Ghosh 3 years ago
parent
commit
71a4cf6479
27 changed files with 33 additions and 234 deletions
  1. +1
    -14
      src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs
  2. +1
    -3
      src/Services/Catalog/Catalog.API/Controllers/HomeController.cs
  3. +1
    -10
      src/Services/Catalog/Catalog.API/Controllers/PicController.cs
  4. +1
    -10
      src/Services/Catalog/Catalog.API/Extensions/HostExtensions.cs
  5. +1
    -5
      src/Services/Catalog/Catalog.API/Extensions/LinqSelectExtensions.cs
  6. +1
    -10
      src/Services/Catalog/Catalog.API/Extensions/WebHostExtensions.cs
  7. +2
    -13
      src/Services/Catalog/Catalog.API/Grpc/CatalogService.cs
  8. +1
    -4
      src/Services/Catalog/Catalog.API/Infrastructure/ActionResults/InternalServerErrorObjectResult.cs
  9. +3
    -6
      src/Services/Catalog/Catalog.API/Infrastructure/CatalogContext.cs
  10. +3
    -18
      src/Services/Catalog/Catalog.API/Infrastructure/CatalogContextSeed.cs
  11. +1
    -5
      src/Services/Catalog/Catalog.API/Infrastructure/EntityConfigurations/CatalogBrandEntityTypeConfiguration.cs
  12. +1
    -5
      src/Services/Catalog/Catalog.API/Infrastructure/EntityConfigurations/CatalogItemEntityTypeConfiguration.cs
  13. +1
    -5
      src/Services/Catalog/Catalog.API/Infrastructure/EntityConfigurations/CatalogTypeEntityTypeConfiguration.cs
  14. +1
    -3
      src/Services/Catalog/Catalog.API/Infrastructure/Exceptions/CatalogDomainException.cs
  15. +1
    -11
      src/Services/Catalog/Catalog.API/Infrastructure/Filters/HttpGlobalExceptionFilter.cs
  16. +1
    -12
      src/Services/Catalog/Catalog.API/IntegrationEvents/CatalogIntegrationEventService.cs
  17. +1
    -11
      src/Services/Catalog/Catalog.API/IntegrationEvents/EventHandling/OrderStatusChangedToAwaitingValidationIntegrationEventHandler.cs
  18. +1
    -8
      src/Services/Catalog/Catalog.API/IntegrationEvents/EventHandling/OrderStatusChangedToPaidIntegrationEventHandler.cs
  19. +1
    -4
      src/Services/Catalog/Catalog.API/IntegrationEvents/Events/OrderStatusChangedToAwaitingValidationIntegrationEvent.cs
  20. +1
    -3
      src/Services/Catalog/Catalog.API/IntegrationEvents/Events/OrderStockConfirmedIntegrationEvent.cs
  21. +1
    -4
      src/Services/Catalog/Catalog.API/IntegrationEvents/Events/OrderStockRejectedIntegrationEvent.cs
  22. +1
    -3
      src/Services/Catalog/Catalog.API/IntegrationEvents/Events/ProductPriceChangedIntegrationEvent.cs
  23. +1
    -4
      src/Services/Catalog/Catalog.API/IntegrationEvents/ICatalogIntegrationEventService.cs
  24. +1
    -4
      src/Services/Catalog/Catalog.API/Model/CatalogItem.cs
  25. +2
    -20
      src/Services/Catalog/Catalog.API/Program.cs
  26. +1
    -35
      src/Services/Catalog/Catalog.API/Startup.cs
  27. +1
    -4
      src/Services/Catalog/Catalog.API/ViewModel/PaginatedItemsViewModel.cs

+ 1
- 14
src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs View File

@ -1,17 +1,4 @@
using Catalog.API.IntegrationEvents;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
using Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.Events;
using Microsoft.eShopOnContainers.Services.Catalog.API.Model;
using Microsoft.eShopOnContainers.Services.Catalog.API.ViewModel;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using Microsoft.eShopOnContainers.Services.Catalog.API.Model;
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
{
[Route("api/v1/[controller]")]


+ 1
- 3
src/Services/Catalog/Catalog.API/Controllers/HomeController.cs View File

@ -1,6 +1,4 @@
using Microsoft.AspNetCore.Mvc;
// For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
// For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
{


+ 1
- 10
src/Services/Catalog/Catalog.API/Controllers/PicController.cs View File

@ -1,13 +1,4 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
using System.IO;
using System.Net;
using System.Threading.Tasks;
// For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
// For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
{
[ApiController]


+ 1
- 10
src/Services/Catalog/Catalog.API/Extensions/HostExtensions.cs View File

@ -1,13 +1,4 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Polly;
using System;
using System.Data.SqlClient;
namespace Catalog.API.Extensions
namespace Catalog.API.Extensions
{
public static class HostExtensions
{


+ 1
- 5
src/Services/Catalog/Catalog.API/Extensions/LinqSelectExtensions.cs View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace Catalog.API.Extensions
namespace Catalog.API.Extensions
{
public static class LinqSelectExtensions
{


+ 1
- 10
src/Services/Catalog/Catalog.API/Extensions/WebHostExtensions.cs View File

@ -1,13 +1,4 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Polly;
using System;
using System.Data.SqlClient;
namespace Catalog.API.Extensions
namespace Catalog.API.Extensions
{
public static class WebHostExtensions
{


+ 2
- 13
src/Services/Catalog/Catalog.API/Grpc/CatalogService.cs View File

@ -1,24 +1,13 @@
using CatalogApi;
using Grpc.Core;
using Microsoft.EntityFrameworkCore;
using Microsoft.eShopOnContainers.Services.Catalog.API;
using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
using Microsoft.eShopOnContainers.Services.Catalog.API.Model;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using static CatalogApi.Catalog;
namespace Catalog.API.Grpc
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Grpc
{
public class CatalogService : CatalogBase
{
private readonly CatalogContext _catalogContext;
private readonly CatalogSettings _settings;
private readonly ILogger _logger;
private readonly Extensions.Logging.ILogger _logger;
public CatalogService(CatalogContext dbContext, IOptions<CatalogSettings> settings, ILogger<CatalogService> logger)
{


+ 1
- 4
src/Services/Catalog/Catalog.API/Infrastructure/ActionResults/InternalServerErrorObjectResult.cs View File

@ -1,7 +1,4 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace Catalog.API.Infrastructure.ActionResults
namespace Catalog.API.Infrastructure.ActionResults
{
public class InternalServerErrorObjectResult : ObjectResult
{


+ 3
- 6
src/Services/Catalog/Catalog.API/Infrastructure/CatalogContext.cs View File

@ -1,10 +1,7 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure
{
using EntityConfigurations;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Model;
using Microsoft.eShopOnContainers.Services.Catalog.API.Model;
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure
{
public class CatalogContext : DbContext
{
public CatalogContext(DbContextOptions<CatalogContext> options) : base(options)


+ 3
- 18
src/Services/Catalog/Catalog.API/Infrastructure/CatalogContextSeed.cs View File

@ -1,22 +1,7 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure
{
using Extensions.Logging;
using global::Catalog.API.Extensions;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Options;
using Model;
using Polly;
using Polly.Retry;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Microsoft.eShopOnContainers.Services.Catalog.API.Model;
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure
{
public class CatalogContextSeed
{
public async Task SeedAsync(CatalogContext context, IWebHostEnvironment env, IOptions<CatalogSettings> settings, ILogger<CatalogContextSeed> logger)


+ 1
- 5
src/Services/Catalog/Catalog.API/Infrastructure/EntityConfigurations/CatalogBrandEntityTypeConfiguration.cs View File

@ -1,8 +1,4 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.eShopOnContainers.Services.Catalog.API.Model;
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure.EntityConfigurations
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure.EntityConfigurations
{
class CatalogBrandEntityTypeConfiguration
: IEntityTypeConfiguration<CatalogBrand>


+ 1
- 5
src/Services/Catalog/Catalog.API/Infrastructure/EntityConfigurations/CatalogItemEntityTypeConfiguration.cs View File

@ -1,8 +1,4 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.eShopOnContainers.Services.Catalog.API.Model;
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure.EntityConfigurations
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure.EntityConfigurations
{
class CatalogItemEntityTypeConfiguration
: IEntityTypeConfiguration<CatalogItem>


+ 1
- 5
src/Services/Catalog/Catalog.API/Infrastructure/EntityConfigurations/CatalogTypeEntityTypeConfiguration.cs View File

@ -1,8 +1,4 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.eShopOnContainers.Services.Catalog.API.Model;
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure.EntityConfigurations
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure.EntityConfigurations
{
class CatalogTypeEntityTypeConfiguration
: IEntityTypeConfiguration<CatalogType>


+ 1
- 3
src/Services/Catalog/Catalog.API/Infrastructure/Exceptions/CatalogDomainException.cs View File

@ -1,6 +1,4 @@
using System;
namespace Catalog.API.Infrastructure.Exceptions
namespace Catalog.API.Infrastructure.Exceptions
{
/// <summary>
/// Exception type for app exceptions


+ 1
- 11
src/Services/Catalog/Catalog.API/Infrastructure/Filters/HttpGlobalExceptionFilter.cs View File

@ -1,14 +1,4 @@
using Catalog.API.Infrastructure.ActionResults;
using Catalog.API.Infrastructure.Exceptions;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System.Net;
namespace Catalog.API.Infrastructure.Filters
namespace Catalog.API.Infrastructure.Filters
{
public class HttpGlobalExceptionFilter : IExceptionFilter
{


+ 1
- 12
src/Services/Catalog/Catalog.API/IntegrationEvents/CatalogIntegrationEventService.cs View File

@ -1,15 +1,4 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services;
using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Utilities;
using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
using Microsoft.Extensions.Logging;
using System;
using System.Data.Common;
using System.Threading.Tasks;
namespace Catalog.API.IntegrationEvents
namespace Catalog.API.IntegrationEvents
{
public class CatalogIntegrationEventService : ICatalogIntegrationEventService, IDisposable
{


+ 1
- 11
src/Services/Catalog/Catalog.API/IntegrationEvents/EventHandling/OrderStatusChangedToAwaitingValidationIntegrationEventHandler.cs View File

@ -1,16 +1,6 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.EventHandling
{
using BuildingBlocks.EventBus.Abstractions;
using BuildingBlocks.EventBus.Events;
using global::Catalog.API.IntegrationEvents;
using Infrastructure;
using IntegrationEvents.Events;
using Microsoft.Extensions.Logging;
using Serilog.Context;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
public class OrderStatusChangedToAwaitingValidationIntegrationEventHandler :
IIntegrationEventHandler<OrderStatusChangedToAwaitingValidationIntegrationEvent>
{


+ 1
- 8
src/Services/Catalog/Catalog.API/IntegrationEvents/EventHandling/OrderStatusChangedToPaidIntegrationEventHandler.cs View File

@ -1,12 +1,5 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.EventHandling
{
using BuildingBlocks.EventBus.Abstractions;
using Infrastructure;
using Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.Events;
using Microsoft.Extensions.Logging;
using Serilog.Context;
using System.Threading.Tasks;
{
public class OrderStatusChangedToPaidIntegrationEventHandler :
IIntegrationEventHandler<OrderStatusChangedToPaidIntegrationEvent>
{


+ 1
- 4
src/Services/Catalog/Catalog.API/IntegrationEvents/Events/OrderStatusChangedToAwaitingValidationIntegrationEvent.cs View File

@ -1,8 +1,5 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.Events
{
using BuildingBlocks.EventBus.Events;
using System.Collections.Generic;
{
public record OrderStatusChangedToAwaitingValidationIntegrationEvent : IntegrationEvent
{
public int OrderId { get; }


+ 1
- 3
src/Services/Catalog/Catalog.API/IntegrationEvents/Events/OrderStockConfirmedIntegrationEvent.cs View File

@ -1,7 +1,5 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.Events
{
using BuildingBlocks.EventBus.Events;
{
public record OrderStockConfirmedIntegrationEvent : IntegrationEvent
{
public int OrderId { get; }


+ 1
- 4
src/Services/Catalog/Catalog.API/IntegrationEvents/Events/OrderStockRejectedIntegrationEvent.cs View File

@ -1,8 +1,5 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.Events
{
using BuildingBlocks.EventBus.Events;
using System.Collections.Generic;
{
public record OrderStockRejectedIntegrationEvent : IntegrationEvent
{
public int OrderId { get; }


+ 1
- 3
src/Services/Catalog/Catalog.API/IntegrationEvents/Events/ProductPriceChangedIntegrationEvent.cs View File

@ -1,7 +1,5 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.Events
{
using BuildingBlocks.EventBus.Events;
{
// Integration Events notes:
// An Event is “something that has happened in the past”, therefore its name has to be past tense
// An Integration Event is an event that can cause side effects to other microservices, Bounded-Contexts or external systems.


+ 1
- 4
src/Services/Catalog/Catalog.API/IntegrationEvents/ICatalogIntegrationEventService.cs View File

@ -1,7 +1,4 @@
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using System.Threading.Tasks;
namespace Catalog.API.IntegrationEvents
namespace Catalog.API.IntegrationEvents
{
public interface ICatalogIntegrationEventService
{


+ 1
- 4
src/Services/Catalog/Catalog.API/Model/CatalogItem.cs View File

@ -1,7 +1,4 @@
using Catalog.API.Infrastructure.Exceptions;
using System;
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Model
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Model
{
public class CatalogItem
{


+ 2
- 20
src/Services/Catalog/Catalog.API/Program.cs View File

@ -1,21 +1,5 @@
using Catalog.API.Extensions;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF;

using Microsoft.eShopOnContainers.Services.Catalog.API;
using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Serilog;
using System;
using System.IO;
using System.Net;
using Azure.Identity;
using Azure.Core;
var configuration = GetConfiguration();
@ -33,9 +17,7 @@ try
var settings = services.GetService<IOptions<CatalogSettings>>();
var logger = services.GetService<ILogger<CatalogContextSeed>>();
new CatalogContextSeed()
.SeedAsync(context, env, settings, logger)
.Wait();
new CatalogContextSeed().SeedAsync(context, env, settings, logger).Wait();
})
.MigrateDbContext<IntegrationEventLogContext>((_, __) => { });


+ 1
- 35
src/Services/Catalog/Catalog.API/Startup.cs View File

@ -1,38 +1,4 @@
using Autofac;
using Autofac.Extensions.DependencyInjection;
using Catalog.API.Grpc;
using global::Catalog.API.Infrastructure.Filters;
using global::Catalog.API.IntegrationEvents;
using HealthChecks.UI.Client;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.ServiceBus;
using Microsoft.EntityFrameworkCore;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus;
using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF;
using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services;
using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
using Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.EventHandling;
using Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.Events;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Microsoft.OpenApi.Models;
using RabbitMQ.Client;
using System;
using System.Data.Common;
using System.IO;
using System.Reflection;
namespace Microsoft.eShopOnContainers.Services.Catalog.API
namespace Microsoft.eShopOnContainers.Services.Catalog.API
{
public class Startup
{


+ 1
- 4
src/Services/Catalog/Catalog.API/ViewModel/PaginatedItemsViewModel.cs View File

@ -1,8 +1,5 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.ViewModel
{
using System.Collections.Generic;
{
public class PaginatedItemsViewModel<TEntity> where TEntity : class
{
public int PageIndex { get; private set; }


Loading…
Cancel
Save