public static IEventBusBuilder InitEventBus(this IEventBusBuilder builder, Action <IEventBus> configureEventBus) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } if (configureEventBus != null) { builder.Configure <EventBusFactoryOptions>(options => options.EventBusInitActions.Add(configureEventBus)); } return(builder); }
/// <summary> /// 使用内存事件总线 /// </summary> /// <param name="builder"></param> /// <returns></returns> public static IEventBusBuilder UseMemory(this IEventBusBuilder builder) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } builder.Services.TryAddTransient <MemoryEventBus>(); return(builder.Configure <EventBusFactoryOptions>(options => { options.EventBusProvider = new MemoryEventBusProvider(); })); }