autofac / autofac/Autofac.ServiceFabric
Allow a per-registration configurationAction on service and actor registrations
- Dominant language
- C#
- Stars
- 26
- Forks
- 26
- PR merge metrics
- No merged PRs in 30d
Description
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` on the individual registration methods, running after the global action:
```csharp
builder.RegisterStatefulService(
"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.
Contributor guide
Research direction
Start with RegisterStatelessService, RegisterStatefulService, and RegisterActor, then trace configurationAction through IStatelessServiceFactoryRegistration and the related registration interfaces to BeginLifetimeScope. Done means each method accepts an optional action that runs after the global action, while existing callers and the global hook continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp
- Domain
- distributed-systems
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100