mirror of https://github.com/abpframework/abp.git
12 changed files with 48 additions and 105 deletions
@ -1,36 +0,0 @@ |
|||||
using System; |
|
||||
using JetBrains.Annotations; |
|
||||
using Volo.Abp.Threading; |
|
||||
|
|
||||
namespace Volo.Abp.EventBus |
|
||||
{ |
|
||||
public static class EventBusExtensions |
|
||||
{ |
|
||||
/// <summary>
|
|
||||
/// Triggers an event.
|
|
||||
/// </summary>
|
|
||||
/// <typeparam name="TEvent">Event type</typeparam>
|
|
||||
/// <param name="eventBus">Event bus instance</param>
|
|
||||
/// <param name="eventData">Related data for the event</param>
|
|
||||
public static void Publish<TEvent>([NotNull] this IEventBus eventBus, [NotNull] TEvent eventData) |
|
||||
where TEvent : class |
|
||||
{ |
|
||||
Check.NotNull(eventBus, nameof(eventBus)); |
|
||||
|
|
||||
AsyncHelper.RunSync(() => eventBus.PublishAsync(eventData)); |
|
||||
} |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Triggers an event.
|
|
||||
/// </summary>
|
|
||||
/// <param name="eventBus">Event bus instance</param>
|
|
||||
/// <param name="eventType">Event type</param>
|
|
||||
/// <param name="eventData">Related data for the event</param>
|
|
||||
public static void Publish([NotNull] this IEventBus eventBus, [NotNull] Type eventType, [NotNull] object eventData) |
|
||||
{ |
|
||||
Check.NotNull(eventBus, nameof(eventBus)); |
|
||||
|
|
||||
AsyncHelper.RunSync(() => eventBus.PublishAsync(eventType, eventData)); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,21 +0,0 @@ |
|||||
using JetBrains.Annotations; |
|
||||
|
|
||||
namespace Volo.Abp.Threading |
|
||||
{ |
|
||||
public static class RunnableExtensions |
|
||||
{ |
|
||||
public static void Start([NotNull] this IRunnable runnable) |
|
||||
{ |
|
||||
Check.NotNull(runnable, nameof(runnable)); |
|
||||
|
|
||||
AsyncHelper.RunSync(() => runnable.StartAsync()); |
|
||||
} |
|
||||
|
|
||||
public static void Stop([NotNull] this IRunnable runnable) |
|
||||
{ |
|
||||
Check.NotNull(runnable, nameof(runnable)); |
|
||||
|
|
||||
AsyncHelper.RunSync(() => runnable.StopAsync()); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
Loading…
Reference in new issue