Skip to content

Conversation

mnichols
Copy link

What was changed

Support AddNexusService same as other worker Add calls for convenience.

Why?

Because digging into ConfigureOptions isn't as obvious and we already expose AddX calls in other places. This makes things consistent.

  1. Any docs updates needed?
    The Extensions project README.md was updated to use AddNexusService.

Concerns

Ideally, we could use the service provider to register these services instead of forcing ctor while registering...something like:

builder.AddNexusService<IHasANexii>()

I couldn't see a clear way to do this without the terrible pattern:

var serviceProvider = services.BuildServiceProvider();
var nexusService = serviceProvider.GetService<IHasANexii>();

Any other ideas we can try to make this more container friendly?

@mnichols mnichols requested a review from a team as a code owner October 13, 2025 00:36
/// <returns>Same builder instance.</returns>
public static ITemporalWorkerServiceOptionsBuilder AddNexusService(
this ITemporalWorkerServiceOptionsBuilder builder, object serviceHandler) =>
builder.ConfigureOptions(options => options.AddNexusService(serviceHandler));
Copy link
Member

Choose a reason for hiding this comment

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

I am afraid to do this right, we'll need to support the different transient/scoped/static lifetimes and accept types and such so DI will work. I have opened #536 (not sure why I didn't have it before). Can tackle here or give us a bit to get around to it (Nexus .NET is missing a few things in its pre-release state that we are tracking).

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.

2 participants