Scrutor
Scrutor copied to clipboard
Problem to use Scan with IMediatR
I'm using IMediatR lib, so before Scrutor I registered my Queries like that:
services.AddTransient<IRequestHandler<FindPlaceQuery, Result<List<FindPlaceDto>>>, FindPlaceQueryHandler>();
Now, with Scan I did like that and it's wooking perfectly:
scan.FromAssemblies(typeof(CreateClientCommand).GetTypeInfo().Assembly)
.AddClasses(classes => classes.AssignableTo(typeof(IRequestHandler<,>)))
.AsImplementedInterfaces()
.WithTransientLifetime()
.AddClasses(classes => classes.AssignableTo(typeof(INotificationHandler<>)))
.AsImplementedInterfaces()
.WithTransientLifetime()
.AddClasses()
.AsMatchingInterface());
But I have a different scenario where it doesn't work, when i'm using a generic type for my query the Scrutor could not solve de dependency:
services.AddTransient<IRequestHandler<GetConfigurationValueByKeyQuery<int>, int>, GetConfigurationValueByKeyQueryHandler<int>>()
there's a lot of bugs in there
@jposert That's a pretty pathetic bug report. Any more details would be welcome. Preferably in a separate issue. Scrutor has 19,021,071 downloads and very few of those users (including you) have bothered to file a bug report, so either there's not "a lot of bugs in there" or they can't be very severe. I'm guessing it's the former and you're full of 💩😅 Looking forward to your proper bug report 😬
guys, guys....