You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for better performance, i chose Mediator instead of IMediator, but i get CS0118: 'Mediator' is a namespace but is used like a type error, so i have to explicitly declare Mediator by "MyNameSpace.Mediator" for every call , do you have better way to solve this ?
example
usingMicrosoft.Extensions.DependencyInjection;namespaceConsoleApp1{internalclassProgram{privatestaticvoidMain(string[]args){varservice=newServiceCollection().AddMediator(options =>options.Namespace="MyNamespace").BuildServiceProvider();}}publicclassTest{privatereadonlyIServiceProvider_service;publicTest(IServiceProviderservice){_service=service;}publicvoidResolveMediator(){Mediatormediator=_service.GetRequiredService<Mediator>();// here i will get cs0018 errorMyNamespace.Mediatormediator1=_service.GetRequiredService<MyNamespace.Mediator>();// this will work, but i wanna know is there any better way to avoid type "MyNamespace." every time }}}
The text was updated successfully, but these errors were encountered:
Ahh, no matter what namespace is configured, the Mediator implementation will always collide with the Mediator namespace from the abstractions package (where IRequest etc is). One option is to create a global alias using global usings: global using MyMediator = MyNamespace.Mediator or similar. I'll have to think about refactoring this without having too many breaking changes... Thanks for bringit it up 👍
for better performance, i chose Mediator instead of IMediator, but i get CS0118: 'Mediator' is a namespace but is used like a type error, so i have to explicitly declare Mediator by "MyNameSpace.Mediator" for every call , do you have better way to solve this ?
example
The text was updated successfully, but these errors were encountered: