Moved individual usings statements to globalusing

This commit is contained in:
Sumit Ghosh 2021-10-07 18:31:06 +05:30
parent d996cf169e
commit 71a4cf6479
27 changed files with 33 additions and 234 deletions

View File

@ -1,17 +1,4 @@
using Catalog.API.IntegrationEvents; using Microsoft.eShopOnContainers.Services.Catalog.API.Model;
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;
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
{ {
[Route("api/v1/[controller]")] [Route("api/v1/[controller]")]

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 namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
{ {

View File

@ -1,13 +1,4 @@
using Microsoft.AspNetCore.Hosting; // For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
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
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
{ {
[ApiController] [ApiController]

View File

@ -1,13 +1,4 @@
using Microsoft.EntityFrameworkCore; namespace Catalog.API.Extensions
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
{ {
public static class HostExtensions public static class HostExtensions
{ {

View File

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

View File

@ -1,13 +1,4 @@
using Microsoft.AspNetCore.Hosting; namespace Catalog.API.Extensions
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
{ {
public static class WebHostExtensions public static class WebHostExtensions
{ {

View File

@ -1,24 +1,13 @@
using CatalogApi; 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; using static CatalogApi.Catalog;
namespace Catalog.API.Grpc namespace Microsoft.eShopOnContainers.Services.Catalog.API.Grpc
{ {
public class CatalogService : CatalogBase public class CatalogService : CatalogBase
{ {
private readonly CatalogContext _catalogContext; private readonly CatalogContext _catalogContext;
private readonly CatalogSettings _settings; private readonly CatalogSettings _settings;
private readonly ILogger _logger; private readonly Extensions.Logging.ILogger _logger;
public CatalogService(CatalogContext dbContext, IOptions<CatalogSettings> settings, ILogger<CatalogService> logger) public CatalogService(CatalogContext dbContext, IOptions<CatalogSettings> settings, ILogger<CatalogService> logger)
{ {

View File

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

View File

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

View File

@ -1,22 +1,7 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure using Microsoft.eShopOnContainers.Services.Catalog.API.Model;
{
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;
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure
{
public class CatalogContextSeed public class CatalogContextSeed
{ {
public async Task SeedAsync(CatalogContext context, IWebHostEnvironment env, IOptions<CatalogSettings> settings, ILogger<CatalogContextSeed> logger) public async Task SeedAsync(CatalogContext context, IWebHostEnvironment env, IOptions<CatalogSettings> settings, ILogger<CatalogContextSeed> logger)

View File

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

View File

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

View File

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

View File

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

View File

@ -1,14 +1,4 @@
using Catalog.API.Infrastructure.ActionResults; namespace Catalog.API.Infrastructure.Filters
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
{ {
public class HttpGlobalExceptionFilter : IExceptionFilter public class HttpGlobalExceptionFilter : IExceptionFilter
{ {

View File

@ -1,15 +1,4 @@
using Microsoft.EntityFrameworkCore; namespace Catalog.API.IntegrationEvents
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
{ {
public class CatalogIntegrationEventService : ICatalogIntegrationEventService, IDisposable public class CatalogIntegrationEventService : ICatalogIntegrationEventService, IDisposable
{ {

View File

@ -1,16 +1,6 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.EventHandling 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 : public class OrderStatusChangedToAwaitingValidationIntegrationEventHandler :
IIntegrationEventHandler<OrderStatusChangedToAwaitingValidationIntegrationEvent> IIntegrationEventHandler<OrderStatusChangedToAwaitingValidationIntegrationEvent>
{ {

View File

@ -1,12 +1,5 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.EventHandling 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 : public class OrderStatusChangedToPaidIntegrationEventHandler :
IIntegrationEventHandler<OrderStatusChangedToPaidIntegrationEvent> IIntegrationEventHandler<OrderStatusChangedToPaidIntegrationEvent>
{ {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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;
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(); var configuration = GetConfiguration();
@ -33,9 +17,7 @@ try
var settings = services.GetService<IOptions<CatalogSettings>>(); var settings = services.GetService<IOptions<CatalogSettings>>();
var logger = services.GetService<ILogger<CatalogContextSeed>>(); var logger = services.GetService<ILogger<CatalogContextSeed>>();
new CatalogContextSeed() new CatalogContextSeed().SeedAsync(context, env, settings, logger).Wait();
.SeedAsync(context, env, settings, logger)
.Wait();
}) })
.MigrateDbContext<IntegrationEventLogContext>((_, __) => { }); .MigrateDbContext<IntegrationEventLogContext>((_, __) => { });

View File

@ -1,38 +1,4 @@
using Autofac; namespace Microsoft.eShopOnContainers.Services.Catalog.API
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
{ {
public class Startup public class Startup
{ {

View File

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