Add support for keyed services#105
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for keyed services by introducing a new service resolver provider parameter across various command and interaction components. The key changes include:
- Updating InvocationHelper delegate creation methods to accept an additional service resolver provider.
- Modifying interface methods and configuration classes to incorporate the new ServiceResolverProvider.
- Adding a new KeyedServiceResolverProvider implementation and updating related project files.
Reviewed Changes
Copilot reviewed 40 out of 40 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| NetCord.Services/ApplicationCommands/SlashCommandInfo.cs | Updated delegate creation to include ServiceResolverProvider in module commands. |
| NetCord.Services/ApplicationCommands/SlashCommandGroupInfo.cs | Updated InitializeAutocomplete to pass ServiceResolverProvider. |
| NetCord.Services/ApplicationCommands/MessageCommandInfo.cs | Updated delegate creation for message commands with ServiceResolverProvider. |
| NetCord.Services/ApplicationCommands/ISlashCommandParameterNameProcessor.cs | Added Instance properties to parameter name processors. |
| NetCord.Services/ApplicationCommands/IAutocompleteInfo.cs | Updated autocomplete initialization to require ServiceResolverProvider. |
| NetCord.Services/ApplicationCommands/ApplicationCommandServiceConfiguration.cs | Updated configuration to use singleton instances and include ServiceResolverProvider. |
| NetCord.Services/ApplicationCommands/ApplicationCommandService.cs | Modified autocomplete execution to pass ServiceResolverProvider. |
| NetCord.Services/ApplicationCommands/ApplicationCommandResultResolverProvider.cs | Updated to use a singleton instance pattern. |
| Hosting/NetCord.Hosting/NetCord.Hosting.csproj | Added new files for the keyed service resolver support. |
| Hosting/NetCord.Hosting/DelegateHandlerHelper.cs | Updated service expression calls to include KeyedServiceResolverProvider. |
| Hosting/NetCord.Hosting.Services/KeyedServiceResolverProvider.cs | New implementation for keyed service resolution. |
| Hosting/NetCord.Hosting.Services/ContextHelper.cs | Updated context delegate creation to accept ServiceResolverProvider. |
| Hosting/NetCord.Hosting.Services/ComponentInteractions/* | Added ServiceResolverProvider properties and updated context creation logic. |
| Hosting/NetCord.Hosting.Services/Commands/* | Added ServiceResolverProvider properties and updated context creation logic for commands and interactions. |
Comments suppressed due to low confidence (3)
NetCord.Services/ApplicationCommands/SlashCommandInfo.cs:24
- Ensure that InvocationHelper.CreateModuleDelegate has been updated to correctly accept and handle the additional ServiceResolverProvider parameter, and verify that all related call sites are consistent with the new method signature.
_invokeAsync = InvocationHelper.CreateModuleDelegate(method, declaringType, parameters.Select(p => p.Type), configuration.ResultResolverProvider, configuration.ServiceResolverProvider);
NetCord.Services/ApplicationCommands/MessageCommandInfo.cs:17
- Confirm that CreateModuleDelegate is correctly updated to support the additional ServiceResolverProvider parameter, and that the conditional array for messageParameter is handled as intended.
_invokeAsync = InvocationHelper.CreateModuleDelegate(method, declaringType, messageParameter ? [typeof(RestMessage)] : [], configuration.ResultResolverProvider, configuration.ServiceResolverProvider);
Hosting/NetCord.Hosting.Services/ComponentInteractions/ComponentInteractionHandler.cs:50
- Ensure that the updated call to ContextHelper.CreateContextDelegate, which now requires a ServiceResolverProvider, correctly reflects the intended configuration source and that the renaming from _interactionService to _componentInteractionService is consistently applied.
_createContext = optionsValue.CreateContext ?? ContextHelper.CreateContextDelegate<TInteraction, GatewayClient?, TContext>(_componentInteractionService.Configuration.ServiceResolverProvider);
|
The documentation preview is available at https://preview.netcord.dev/105. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.