public override async Task HandleAsync(IContainerDocument containerDocument, DocumentSubscriptionEvent subscriptionEvent) { if (containerDocument is null) { throw new ArgumentNullException(nameof(containerDocument)); } var broadcastCommandType = (subscriptionEvent switch { DocumentSubscriptionEvent.Create => typeof(BroadcastDocumentCreateCommand <>), DocumentSubscriptionEvent.Update => typeof(BroadcastDocumentUpdateCommand <>), DocumentSubscriptionEvent.Delete => typeof(BroadcastDocumentDeleteCommand <>), _ => null })?.MakeGenericType(containerDocument.GetType());
public virtual Task HandleAsync(IContainerDocument containerDocument, DocumentSubscriptionEvent subscriptionEvent) { if (containerDocument is null) { throw new ArgumentNullException(nameof(containerDocument)); } if (CanHandle(containerDocument)) { return((Task)GetHandleMethod(containerDocument).Invoke(this, new object[] { containerDocument, subscriptionEvent })); } throw new NotImplementedException($"Missing document subscription implementation IDocumentSubscription<{containerDocument.GetType().Name}> at {GetType()}"); }