Moved namespaces to global usings for eventbus
This commit is contained in:
parent
f847ec020f
commit
f3d6492340
@ -1,9 +1,6 @@
|
||||
using System.Threading.Tasks;
|
||||
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions
|
||||
public interface IDynamicIntegrationEventHandler
|
||||
{
|
||||
public interface IDynamicIntegrationEventHandler
|
||||
{
|
||||
Task Handle(dynamic eventData);
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,7 @@
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions
|
||||
public interface IEventBus
|
||||
{
|
||||
public interface IEventBus
|
||||
{
|
||||
void Publish(IntegrationEvent @event);
|
||||
|
||||
void Subscribe<T, TH>()
|
||||
@ -19,5 +17,4 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions
|
||||
void Unsubscribe<T, TH>()
|
||||
where TH : IIntegrationEventHandler<T>
|
||||
where T : IntegrationEvent;
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,11 @@
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
using System.Threading.Tasks;
|
||||
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions
|
||||
{
|
||||
public interface IIntegrationEventHandler<in TIntegrationEvent> : IIntegrationEventHandler
|
||||
public interface IIntegrationEventHandler<in TIntegrationEvent> : IIntegrationEventHandler
|
||||
where TIntegrationEvent : IntegrationEvent
|
||||
{
|
||||
{
|
||||
Task Handle(TIntegrationEvent @event);
|
||||
}
|
||||
|
||||
public interface IIntegrationEventHandler
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public interface IIntegrationEventHandler
|
||||
{
|
||||
}
|
||||
|
@ -1,10 +1,7 @@
|
||||
using System;
|
||||
using System.Text.Json.Serialization;
|
||||
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events
|
||||
public record IntegrationEvent
|
||||
{
|
||||
public record IntegrationEvent
|
||||
{
|
||||
public IntegrationEvent()
|
||||
{
|
||||
Id = Guid.NewGuid();
|
||||
@ -23,5 +20,4 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events
|
||||
|
||||
[JsonInclude]
|
||||
public DateTime CreationDate { get; private init; }
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,7 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Extensions;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Extensions
|
||||
public static class GenericTypeExtensions
|
||||
{
|
||||
public static class GenericTypeExtensions
|
||||
{
|
||||
public static string GetGenericTypeName(this Type type)
|
||||
{
|
||||
var typeName = string.Empty;
|
||||
@ -26,5 +23,4 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Extensions
|
||||
{
|
||||
return @object.GetType().GetGenericTypeName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,7 @@
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using static Microsoft.eShopOnContainers.BuildingBlocks.EventBus.InMemoryEventBusSubscriptionsManager;
|
||||
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus
|
||||
public interface IEventBusSubscriptionsManager
|
||||
{
|
||||
public interface IEventBusSubscriptionsManager
|
||||
{
|
||||
bool IsEmpty { get; }
|
||||
event EventHandler<string> OnEventRemoved;
|
||||
void AddDynamicSubscription<TH>(string eventName)
|
||||
@ -30,5 +24,4 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus
|
||||
IEnumerable<SubscriptionInfo> GetHandlersForEvent<T>() where T : IntegrationEvent;
|
||||
IEnumerable<SubscriptionInfo> GetHandlersForEvent(string eventName);
|
||||
string GetEventKey<T>();
|
||||
}
|
||||
}
|
@ -1,13 +1,7 @@
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus
|
||||
public partial class InMemoryEventBusSubscriptionsManager : IEventBusSubscriptionsManager
|
||||
{
|
||||
public partial class InMemoryEventBusSubscriptionsManager : IEventBusSubscriptionsManager
|
||||
{
|
||||
|
||||
|
||||
private readonly Dictionary<string, List<SubscriptionInfo>> _handlers;
|
||||
@ -158,5 +152,4 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus
|
||||
{
|
||||
return typeof(T).Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,7 @@
|
||||
using System;
|
||||
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus
|
||||
public partial class InMemoryEventBusSubscriptionsManager : IEventBusSubscriptionsManager
|
||||
{
|
||||
public partial class InMemoryEventBusSubscriptionsManager : IEventBusSubscriptionsManager
|
||||
{
|
||||
public class SubscriptionInfo
|
||||
{
|
||||
public bool IsDynamic { get; }
|
||||
@ -24,5 +22,4 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus
|
||||
return new SubscriptionInfo(false, handlerType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user