Skip to content

Add MethodExtension to ServiceHandlerInstance - #19

Merged
Quinn-With-Two-Ns merged 3 commits into
mainfrom
NEXUS-415
Aug 6, 2026
Merged

Add MethodExtension to ServiceHandlerInstance#19
Quinn-With-Two-Ns merged 3 commits into
mainfrom
NEXUS-415

Conversation

@Quinn-With-Two-Ns

@Quinn-With-Two-Ns Quinn-With-Two-Ns commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Add MethodExtension to ServiceHandlerInstance. This allows users, like the Temporal SDK, to define custom attributes on service handlers.

This will allow us to define Nexus Service like so.

[NexusServiceHandler(typeof(IStringService))]
public class TransferServiceImpl
{
    [TemporalOperation]
    public Task<TemporalOperationResult<string>> DoSomething(
        TemporalNexusOperationStartContext ctx, ITemporalNexusClient client, string input) =>
        client.StartWorkflowAsync(
            (TransferWorkflow wf) => wf.RunAsync(input),
            new() { Id = $"wf-{Guid.NewGuid()}" });
}

See also temporalio/sdk-dotnet#764

@Quinn-With-Two-Ns
Quinn-With-Two-Ns requested a review from a team as a code owner July 7, 2026 16:26

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 432f618ccc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

/// Result of an <see cref="IMethodExtension"/> matching a method: the operation name it
/// handles and the operation handler for it.
/// </summary>
public sealed class MethodExtensionResult

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Move MethodExtensionResult out of this file

This project treats analyzer warnings as errors via Directory.Build.props, and SA1402 is not disabled globally; adding MethodExtensionResult as a second top-level type in IMethodExtension.cs will trigger the same StyleCop rule that the existing multi-type OperationStartResult.cs has to suppress locally. Move this class to its own file or add an explicit suppression, otherwise builds that run analyzers fail before tests execute.

Useful? React with 👍 / 👎.

Comment thread src/NexusRpc/Handlers/IMethodExtension.cs Outdated
@Quinn-With-Two-Ns
Quinn-With-Two-Ns merged commit 9f4dfc0 into main Aug 6, 2026
6 checks passed
@Quinn-With-Two-Ns
Quinn-With-Two-Ns deleted the NEXUS-415 branch August 6, 2026 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants