Moved all the namespace to globalusings

This commit is contained in:
Sumit Ghosh 2021-10-11 17:57:30 +05:30
parent 6546b63aa4
commit 0fe244cc80
16 changed files with 422 additions and 537 deletions

View File

@ -1,13 +1,8 @@
using Autofac; namespace Microsoft.eShopOnContainers.Services.Ordering.SignalrHub.AutofacModules;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Ordering.SignalrHub.IntegrationEvents;
using System.Reflection;
namespace Ordering.SignalrHub.AutofacModules public class ApplicationModule
{
public class ApplicationModule
: Autofac.Module : Autofac.Module
{ {
public string QueriesConnectionString { get; } public string QueriesConnectionString { get; }
@ -22,5 +17,4 @@ namespace Ordering.SignalrHub.AutofacModules
.AsClosedTypesOf(typeof(IIntegrationEventHandler<>)); .AsClosedTypesOf(typeof(IIntegrationEventHandler<>));
} }
}
} }

View File

@ -1,14 +1,7 @@
using Microsoft.AspNetCore.SignalR; namespace Microsoft.eShopOnContainers.Services.Ordering.SignalrHub.IntegrationEvents;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.Extensions.Logging;
using Serilog.Context;
using System;
using System.Threading.Tasks;
namespace Ordering.SignalrHub.IntegrationEvents public class OrderStatusChangedToAwaitingValidationIntegrationEventHandler : IIntegrationEventHandler<OrderStatusChangedToAwaitingValidationIntegrationEvent>
{ {
public class OrderStatusChangedToAwaitingValidationIntegrationEventHandler : IIntegrationEventHandler<OrderStatusChangedToAwaitingValidationIntegrationEvent>
{
private readonly IHubContext<NotificationsHub> _hubContext; private readonly IHubContext<NotificationsHub> _hubContext;
private readonly ILogger<OrderStatusChangedToAwaitingValidationIntegrationEventHandler> _logger; private readonly ILogger<OrderStatusChangedToAwaitingValidationIntegrationEventHandler> _logger;
@ -32,5 +25,4 @@ namespace Ordering.SignalrHub.IntegrationEvents
.SendAsync("UpdatedOrderState", new { OrderId = @event.OrderId, Status = @event.OrderStatus }); .SendAsync("UpdatedOrderState", new { OrderId = @event.OrderId, Status = @event.OrderStatus });
} }
} }
}
} }

View File

@ -1,15 +1,7 @@
using Microsoft.AspNetCore.SignalR; namespace Microsoft.eShopOnContainers.Services.Ordering.SignalrHub.IntegrationEvents.EventHandling;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.Extensions.Logging;
using Ordering.SignalrHub.IntegrationEvents.Events;
using Serilog.Context;
using System;
using System.Threading.Tasks;
namespace Ordering.SignalrHub.IntegrationEvents.EventHandling public class OrderStatusChangedToCancelledIntegrationEventHandler : IIntegrationEventHandler<OrderStatusChangedToCancelledIntegrationEvent>
{ {
public class OrderStatusChangedToCancelledIntegrationEventHandler : IIntegrationEventHandler<OrderStatusChangedToCancelledIntegrationEvent>
{
private readonly IHubContext<NotificationsHub> _hubContext; private readonly IHubContext<NotificationsHub> _hubContext;
private readonly ILogger<OrderStatusChangedToCancelledIntegrationEventHandler> _logger; private readonly ILogger<OrderStatusChangedToCancelledIntegrationEventHandler> _logger;
@ -33,5 +25,4 @@ namespace Ordering.SignalrHub.IntegrationEvents.EventHandling
.SendAsync("UpdatedOrderState", new { OrderId = @event.OrderId, Status = @event.OrderStatus }); .SendAsync("UpdatedOrderState", new { OrderId = @event.OrderId, Status = @event.OrderStatus });
} }
} }
}
} }

View File

@ -1,15 +1,7 @@
using Microsoft.AspNetCore.SignalR; namespace Microsoft.eShopOnContainers.Services.Ordering.SignalrHub.IntegrationEvents.EventHandling;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.Extensions.Logging;
using Ordering.SignalrHub.IntegrationEvents.Events;
using Serilog.Context;
using System;
using System.Threading.Tasks;
namespace Ordering.SignalrHub.IntegrationEvents.EventHandling public class OrderStatusChangedToPaidIntegrationEventHandler : IIntegrationEventHandler<OrderStatusChangedToPaidIntegrationEvent>
{ {
public class OrderStatusChangedToPaidIntegrationEventHandler : IIntegrationEventHandler<OrderStatusChangedToPaidIntegrationEvent>
{
private readonly IHubContext<NotificationsHub> _hubContext; private readonly IHubContext<NotificationsHub> _hubContext;
private readonly ILogger<OrderStatusChangedToPaidIntegrationEventHandler> _logger; private readonly ILogger<OrderStatusChangedToPaidIntegrationEventHandler> _logger;
@ -33,5 +25,4 @@ namespace Ordering.SignalrHub.IntegrationEvents.EventHandling
.SendAsync("UpdatedOrderState", new { OrderId = @event.OrderId, Status = @event.OrderStatus }); .SendAsync("UpdatedOrderState", new { OrderId = @event.OrderId, Status = @event.OrderStatus });
} }
} }
}
} }

View File

@ -1,15 +1,7 @@
using Microsoft.AspNetCore.SignalR; namespace Microsoft.eShopOnContainers.Services.Ordering.SignalrHub.IntegrationEvents.EventHandling;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.Extensions.Logging;
using Ordering.SignalrHub.IntegrationEvents.Events;
using Serilog.Context;
using System;
using System.Threading.Tasks;
namespace Ordering.SignalrHub.IntegrationEvents.EventHandling public class OrderStatusChangedToShippedIntegrationEventHandler : IIntegrationEventHandler<OrderStatusChangedToShippedIntegrationEvent>
{ {
public class OrderStatusChangedToShippedIntegrationEventHandler : IIntegrationEventHandler<OrderStatusChangedToShippedIntegrationEvent>
{
private readonly IHubContext<NotificationsHub> _hubContext; private readonly IHubContext<NotificationsHub> _hubContext;
private readonly ILogger<OrderStatusChangedToShippedIntegrationEventHandler> _logger; private readonly ILogger<OrderStatusChangedToShippedIntegrationEventHandler> _logger;
@ -33,5 +25,4 @@ namespace Ordering.SignalrHub.IntegrationEvents.EventHandling
.SendAsync("UpdatedOrderState", new { OrderId = @event.OrderId, Status = @event.OrderStatus }); .SendAsync("UpdatedOrderState", new { OrderId = @event.OrderId, Status = @event.OrderStatus });
} }
} }
}
} }

View File

@ -1,16 +1,8 @@
using Microsoft.AspNetCore.SignalR; namespace Microsoft.eShopOnContainers.Services.Ordering.SignalrHub.IntegrationEvents.EventHandling;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.Extensions.Logging;
using Ordering.SignalrHub.IntegrationEvents.Events;
using Serilog.Context;
using System;
using System.Threading.Tasks;
namespace Ordering.SignalrHub.IntegrationEvents.EventHandling public class OrderStatusChangedToStockConfirmedIntegrationEventHandler :
{
public class OrderStatusChangedToStockConfirmedIntegrationEventHandler :
IIntegrationEventHandler<OrderStatusChangedToStockConfirmedIntegrationEvent> IIntegrationEventHandler<OrderStatusChangedToStockConfirmedIntegrationEvent>
{ {
private readonly IHubContext<NotificationsHub> _hubContext; private readonly IHubContext<NotificationsHub> _hubContext;
private readonly ILogger<OrderStatusChangedToStockConfirmedIntegrationEventHandler> _logger; private readonly ILogger<OrderStatusChangedToStockConfirmedIntegrationEventHandler> _logger;
@ -34,5 +26,4 @@ namespace Ordering.SignalrHub.IntegrationEvents.EventHandling
.SendAsync("UpdatedOrderState", new { OrderId = @event.OrderId, Status = @event.OrderStatus }); .SendAsync("UpdatedOrderState", new { OrderId = @event.OrderId, Status = @event.OrderStatus });
} }
} }
}
} }

View File

@ -1,16 +1,7 @@
using Microsoft.AspNetCore.SignalR; namespace Microsoft.eShopOnContainers.Services.Ordering.SignalrHub.IntegrationEvents.EventHandling;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; public class OrderStatusChangedToSubmittedIntegrationEventHandler :
using Microsoft.Extensions.Logging;
using Ordering.SignalrHub.IntegrationEvents.Events;
using Serilog.Context;
using System;
using System.Threading.Tasks;
namespace Ordering.SignalrHub.IntegrationEvents.EventHandling
{
public class OrderStatusChangedToSubmittedIntegrationEventHandler :
IIntegrationEventHandler<OrderStatusChangedToSubmittedIntegrationEvent> IIntegrationEventHandler<OrderStatusChangedToSubmittedIntegrationEvent>
{ {
private readonly IHubContext<NotificationsHub> _hubContext; private readonly IHubContext<NotificationsHub> _hubContext;
private readonly ILogger<OrderStatusChangedToSubmittedIntegrationEventHandler> _logger; private readonly ILogger<OrderStatusChangedToSubmittedIntegrationEventHandler> _logger;
@ -34,5 +25,4 @@ namespace Ordering.SignalrHub.IntegrationEvents.EventHandling
.SendAsync("UpdatedOrderState", new { OrderId = @event.OrderId, Status = @event.OrderStatus }); .SendAsync("UpdatedOrderState", new { OrderId = @event.OrderId, Status = @event.OrderStatus });
} }
} }
}
} }

View File

@ -1,9 +1,6 @@
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events; namespace Microsoft.eShopOnContainers.Services.Ordering.SignalrHub.IntegrationEvents;
public record OrderStatusChangedToAwaitingValidationIntegrationEvent : IntegrationEvent
namespace Ordering.SignalrHub.IntegrationEvents
{ {
public record OrderStatusChangedToAwaitingValidationIntegrationEvent : IntegrationEvent
{
public int OrderId { get; } public int OrderId { get; }
public string OrderStatus { get; } public string OrderStatus { get; }
public string BuyerName { get; } public string BuyerName { get; }
@ -14,5 +11,5 @@ namespace Ordering.SignalrHub.IntegrationEvents
OrderStatus = orderStatus; OrderStatus = orderStatus;
BuyerName = buyerName; BuyerName = buyerName;
} }
}
} }

View File

@ -1,9 +1,7 @@
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events; namespace Microsoft.eShopOnContainers.Services.Ordering.SignalrHub.IntegrationEvents.Events;
namespace Ordering.SignalrHub.IntegrationEvents.Events public record OrderStatusChangedToCancelledIntegrationEvent : IntegrationEvent
{ {
public record OrderStatusChangedToCancelledIntegrationEvent : IntegrationEvent
{
public int OrderId { get; } public int OrderId { get; }
public string OrderStatus { get; } public string OrderStatus { get; }
public string BuyerName { get; } public string BuyerName { get; }
@ -14,5 +12,5 @@ namespace Ordering.SignalrHub.IntegrationEvents.Events
OrderStatus = orderStatus; OrderStatus = orderStatus;
BuyerName = buyerName; BuyerName = buyerName;
} }
}
} }

View File

@ -1,9 +1,7 @@
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events; namespace Microsoft.eShopOnContainers.Services.Ordering.SignalrHub.IntegrationEvents.Events;
namespace Ordering.SignalrHub.IntegrationEvents.Events public record OrderStatusChangedToPaidIntegrationEvent : IntegrationEvent
{ {
public record OrderStatusChangedToPaidIntegrationEvent : IntegrationEvent
{
public int OrderId { get; } public int OrderId { get; }
public string OrderStatus { get; } public string OrderStatus { get; }
public string BuyerName { get; } public string BuyerName { get; }
@ -15,5 +13,4 @@ namespace Ordering.SignalrHub.IntegrationEvents.Events
OrderStatus = orderStatus; OrderStatus = orderStatus;
BuyerName = buyerName; BuyerName = buyerName;
} }
}
} }

View File

@ -1,9 +1,7 @@
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events; namespace Microsoft.eShopOnContainers.Services.Ordering.SignalrHub.IntegrationEvents.Events;
namespace Ordering.SignalrHub.IntegrationEvents.Events public record OrderStatusChangedToShippedIntegrationEvent : IntegrationEvent
{ {
public record OrderStatusChangedToShippedIntegrationEvent : IntegrationEvent
{
public int OrderId { get; } public int OrderId { get; }
public string OrderStatus { get; } public string OrderStatus { get; }
public string BuyerName { get; } public string BuyerName { get; }
@ -14,5 +12,5 @@ namespace Ordering.SignalrHub.IntegrationEvents.Events
OrderStatus = orderStatus; OrderStatus = orderStatus;
BuyerName = buyerName; BuyerName = buyerName;
} }
}
} }

View File

@ -1,9 +1,7 @@
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events; namespace Microsoft.eShopOnContainers.Services.Ordering.SignalrHub.IntegrationEvents.Events;
namespace Ordering.SignalrHub.IntegrationEvents.Events public record OrderStatusChangedToStockConfirmedIntegrationEvent : IntegrationEvent
{ {
public record OrderStatusChangedToStockConfirmedIntegrationEvent : IntegrationEvent
{
public int OrderId { get; } public int OrderId { get; }
public string OrderStatus { get; } public string OrderStatus { get; }
public string BuyerName { get; } public string BuyerName { get; }
@ -14,5 +12,4 @@ namespace Ordering.SignalrHub.IntegrationEvents.Events
OrderStatus = orderStatus; OrderStatus = orderStatus;
BuyerName = buyerName; BuyerName = buyerName;
} }
}
} }

View File

@ -1,9 +1,7 @@
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events; namespace Microsoft.eShopOnContainers.Services.Ordering.SignalrHub.IntegrationEvents.Events;
namespace Ordering.SignalrHub.IntegrationEvents.Events public record OrderStatusChangedToSubmittedIntegrationEvent : IntegrationEvent
{ {
public record OrderStatusChangedToSubmittedIntegrationEvent : IntegrationEvent
{
public int OrderId { get; } public int OrderId { get; }
public string OrderStatus { get; } public string OrderStatus { get; }
public string BuyerName { get; } public string BuyerName { get; }
@ -14,5 +12,4 @@ namespace Ordering.SignalrHub.IntegrationEvents.Events
OrderStatus = orderStatus; OrderStatus = orderStatus;
BuyerName = buyerName; BuyerName = buyerName;
} }
}
} }

View File

@ -1,13 +1,8 @@
using Microsoft.AspNetCore.Authorization; namespace Microsoft.eShopOnContainers.Services.Ordering.SignalrHub;
using Microsoft.AspNetCore.SignalR;
using System;
using System.Threading.Tasks;
namespace Ordering.SignalrHub [Authorize]
public class NotificationsHub : Hub
{ {
[Authorize]
public class NotificationsHub : Hub
{
public override async Task OnConnectedAsync() public override async Task OnConnectedAsync()
{ {
@ -20,5 +15,4 @@ namespace Ordering.SignalrHub
await Groups.RemoveFromGroupAsync(Context.ConnectionId, Context.User.Identity.Name); await Groups.RemoveFromGroupAsync(Context.ConnectionId, Context.User.Identity.Name);
await base.OnDisconnectedAsync(ex); await base.OnDisconnectedAsync(ex);
} }
}
} }

View File

@ -1,12 +1,4 @@
using Microsoft.AspNetCore; var configuration = GetConfiguration();
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Serilog;
using System;
using System.IO;
using Ordering.SignalrHub;
var configuration = GetConfiguration();
Log.Logger = CreateSerilogLogger(configuration); Log.Logger = CreateSerilogLogger(configuration);

View File

@ -1,31 +1,7 @@
using Autofac; namespace Microsoft.eShopOnContainers.Services.Ordering.SignalrHub;
using Autofac.Extensions.DependencyInjection;
using HealthChecks.UI.Client;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.Azure.ServiceBus;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Logging;
using Ordering.SignalrHub.AutofacModules;
using Ordering.SignalrHub.IntegrationEvents;
using Ordering.SignalrHub.IntegrationEvents.EventHandling;
using Ordering.SignalrHub.IntegrationEvents.Events;
using RabbitMQ.Client;
using System;
using System.IdentityModel.Tokens.Jwt;
using System.Threading.Tasks;
namespace Ordering.SignalrHub public class Startup
{ {
public class Startup
{
public Startup(IConfiguration configuration) public Startup(IConfiguration configuration)
{ {
Configuration = configuration; Configuration = configuration;
@ -240,10 +216,10 @@ namespace Ordering.SignalrHub
services.AddSingleton<IEventBusSubscriptionsManager, InMemoryEventBusSubscriptionsManager>(); services.AddSingleton<IEventBusSubscriptionsManager, InMemoryEventBusSubscriptionsManager>();
} }
} }
public static class CustomExtensionMethods public static class CustomExtensionMethods
{ {
public static IServiceCollection AddCustomHealthCheck(this IServiceCollection services, IConfiguration configuration) public static IServiceCollection AddCustomHealthCheck(this IServiceCollection services, IConfiguration configuration)
{ {
var hcBuilder = services.AddHealthChecks(); var hcBuilder = services.AddHealthChecks();
@ -270,5 +246,4 @@ namespace Ordering.SignalrHub
return services; return services;
} }
}
} }