public static void RegisterOutboxToOutboxProcessor(IOutboxProcessor outboxProcessor, Type outboxType, string boundedContext, OutboxPublicationType publicationType) { outboxType.EnsureDerivesFromInterface(typeof(IOutbox)); MethodInfo?method = outboxProcessor.GetType() .GetMethod(nameof(IOutboxProcessor.Register), 1, new Type[] { typeof(string), typeof(OutboxPublicationType) }); MethodInfo?generic = method !.MakeGenericMethod(outboxType); generic !.Invoke(outboxProcessor, new object[] { boundedContext, publicationType }); }
public void Register <TOutbox>(string boundedContext, OutboxPublicationType publicationType) where TOutbox : IOutbox { Registrations.Add(boundedContext, publicationType); }