Explicit dependency injection for ContainerNamesQueryHandler.
The handler receives the entire IServiceProvider but only needs IBlobServiceFactory. Pass the factory explicitly instead, matching the pattern used by ListQueryHandler and ChunkHydrationStatusQueryHandler:
services.AddSingleton<IStreamQueryHandler<ContainerNamesQuery, string>>(sp =>
new ContainerNamesQueryHandler(
sp.GetRequiredService()));
Then update the handler constructor to ContainerNamesQueryHandler(IBlobServiceFactory blobServiceFactory). This makes dependencies explicit and testable.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @src/Arius.Core/ServiceCollectionExtensions.cs around lines 94 - 96, Replace
the anonymous factory that injects the whole IServiceProvider into the
ContainerNamesQueryHandler with an explicit dependency on IBlobServiceFactory:
update the registration of IStreamQueryHandler<ContainerNamesQuery, string> to
resolve sp.GetRequiredService() and pass that into the
handler, and change the ContainerNamesQueryHandler constructor signature to
ContainerNamesQueryHandler(IBlobServiceFactory blobServiceFactory) so the
handler only depends on IBlobServiceFactory (matching the pattern used by
ListQueryHandler and ChunkHydrationStatusQueryHandler) and is easier to unit
test.
Explicit dependency injection for ContainerNamesQueryHandler.
The handler receives the entire IServiceProvider but only needs IBlobServiceFactory. Pass the factory explicitly instead, matching the pattern used by ListQueryHandler and ChunkHydrationStatusQueryHandler:
services.AddSingleton<IStreamQueryHandler<ContainerNamesQuery, string>>(sp =>
new ContainerNamesQueryHandler(
sp.GetRequiredService()));
Then update the handler constructor to ContainerNamesQueryHandler(IBlobServiceFactory blobServiceFactory). This makes dependencies explicit and testable.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
@src/Arius.Core/ServiceCollectionExtensions.csaround lines 94 - 96, Replacethe anonymous factory that injects the whole IServiceProvider into the
ContainerNamesQueryHandler with an explicit dependency on IBlobServiceFactory:
update the registration of IStreamQueryHandler<ContainerNamesQuery, string> to
resolve sp.GetRequiredService() and pass that into the
handler, and change the ContainerNamesQueryHandler constructor signature to
ContainerNamesQueryHandler(IBlobServiceFactory blobServiceFactory) so the
handler only depends on IBlobServiceFactory (matching the pattern used by
ListQueryHandler and ChunkHydrationStatusQueryHandler) and is easier to unit
test.