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
Split IMediator interface in IPublisher and ISender interface #563
Conversation
Oh yes, I've removed unused usings as this is a pet peeve of mine. 😃 |
test/MediatR.Tests/PipelineTests.cs
Outdated
using System.Collections.Generic; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Shouldly; | ||
using StructureMap; | ||
using Xunit; | ||
|
||
namespace MediatR.Tests | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using Shouldly; | ||
using StructureMap; | ||
using Xunit; | ||
|
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 understand removing unused references, but I don't know the implications of moving usings from inside the namespace to outside, any reason for doing so?
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.
There is no benefit to using a using
statement inside or outside of the namespace. I think the only difference is the scope. So the using
s inside the namespace are only accessible inside the namespace and the using
s outside are for the whole file. Since there is only one namespace in this file, it won't matter.
When I saw this in the file, my neurotic nature wanted to put them together as they belong together.
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.
If you want, I can go over the code and put them all together and order them alphabetically.
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.
If they are functionally the same it doesn't matter to me, I'll defer to Jimmy. I've always put them outside but have seen them inside namespaces as well.
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.
Ok, I'll leave it up to @jbogard to decide if I roll this back, if I format and order the rest of the using
s in the codebase or if this is ok.
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 prefer consistency tbqh
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.
Would you like me to roll it back or would you like me to look through the codebase and format the other places?
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.
If it's not consistent in the codebase today, leave it alone.
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.
Should be rolled back now. I did remove the unused using, which I did throughout the codebase.
@KenBonny once this is merged the dependency injection package should be updated as well to register the publisher and sender. https://github.com/jbogard/MediatR.Extensions.Microsoft.DependencyInjection |
@lilasquared Thanks for the heads up. I think the only thing that needs to happen is for the MediatR package to be updated. If the |
I'm pretty sure that only scans and searches for implementations of the handlers. I'm referring to https://github.com/jbogard/MediatR.Extensions.Microsoft.DependencyInjection/blob/master/src/MediatR.Extensions.Microsoft.DependencyInjection/Registration/ServiceRegistrar.cs#L220 |
@@ -2,7 +2,6 @@ | |||
|
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 kinda feel that this whole file should be reverted, bar the removing of the namespace - just inconsistent formatting
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 rolled it back. On save, my IDE (Rider) formats all open files to my coding standards.
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.
So basically I need an .editorconfig
Is this ok, can it be merged or do other steps need to happen? That the other reviewers approve, for example. Or do I need to press a button to merge the PR? |
Don't mistake my question for impatience, but when will this be available in the package? I'm asking so I can also update the DI package @lilasquared mentioned. I have a leaky memory (I should get that looked after) and if this takes a month or 2 (which is fine 😄 ), then I need to add a calendar notification to remind me to do the DI update then. |
Tagged! Should be on NuGet shortly. |
@jbogard If you make such changes, please consider increasing the major version instead of the minor version in the future ;-) This interface split is technically a breaking change. System.MissingMethodException : Method not found: 'System.Threading.Tasks.Task`1<!!0> MediatR.IMediator.Send(MediatR.IRequest`1<!!0>, System.Threading.CancellationToken)'. Thanks 😃 |
The reason for this change is the quick twitter chat I had with Jimmy about this.