-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Provide default implementation for IHubFilter.InvokeMethodAsync #23968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -19,7 +19,7 @@ public interface IHubFilter | |||
/// <param name="invocationContext">The context for the method invocation that holds all the important information about the invoke.</param> | |||
/// <param name="next">The next filter to run, and for the final one, the Hub invocation.</param> | |||
/// <returns>Returns the result of the Hub method invoke.</returns> | |||
ValueTask<object> InvokeMethodAsync(HubInvocationContext invocationContext, Func<HubInvocationContext, ValueTask<object>> next); | |||
ValueTask<object> InvokeMethodAsync(HubInvocationContext invocationContext, Func<HubInvocationContext, ValueTask<object>> next) => next(invocationContext); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be worth adding a simple test that verifies you don't have to implement InvokeMethodAsync.
@@ -19,7 +19,7 @@ public interface IHubFilter | |||
/// <param name="invocationContext">The context for the method invocation that holds all the important information about the invoke.</param> | |||
/// <param name="next">The next filter to run, and for the final one, the Hub invocation.</param> | |||
/// <returns>Returns the result of the Hub method invoke.</returns> | |||
ValueTask<object> InvokeMethodAsync(HubInvocationContext invocationContext, Func<HubInvocationContext, ValueTask<object>> next); | |||
ValueTask<object> InvokeMethodAsync(HubInvocationContext invocationContext, Func<HubInvocationContext, ValueTask<object>> next) => next(invocationContext); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are hub filters an interface with a default implementation rather than an abstract base class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're rebels. I actually think it's a good experiment to try this on
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of how people generally call base.FunctionName();
(and intellisense adds it automatically) with abstract base classes when the base class does nothing
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
@halter73 mentioned we should probably add a default for this as well. It's not too hard to imagine filters being written that don't want to implement
InvokeMethodAsync
.