You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow a per-registration configurationAction on service and actor registrations #70
Follow-up to #57, which is closed now that the global hook it asked for has shipped.
RegisterServiceFabricSupport accepts a configurationAction that runs while each service or actor lifetime scope is being built. It's the only place a component that needs ServiceContext at construction time can be registered, and it works — but it's global: the same action runs for every service and actor in the host.
That's awkward when registrations differ per service. The original issue ran into it directly: registering IReliableStateManager only makes sense for a stateful service, so with a single global action you end up branching inside the callback on what kind of service is being constructed.
Proposal
Accept an optional Action<ContainerBuilder> on the individual registration methods, running after the global action:
builder.RegisterStatefulService<MyService>("MyServiceType",configurationAction: b =>b.Register(c =>/* stateful-only registrations */));
Applies to RegisterStatelessService, RegisterStatefulService, and RegisterActor. The plumbing already exists — IStatelessServiceFactoryRegistration and friends thread a configurationAction through to BeginLifetimeScope, so this is mostly a matter of composing a second action alongside the global one.
The global hook stays as-is, so this is additive for callers who don't need per-service registrations.
Activity