DI: Registration of services through a builder.
I'm making a library to be "registered" like
The
For example:
I want one of these
The way I was thinking about it was to have an internal
Any better suggestion?
services.AddMyFeature(builder => ...);The
builder can be used a bit like ASP's registration with the AddAuthorization, AddPolicy, etc.For example:
I want one of these
builder.AddSubFeature() (the equivalent of the c.AddPolicy(...) above) to add some more registrations in services.The way I was thinking about it was to have an internal
List<Action<IServiceCollection>> on the builder in which builder.AddSubFeature() would add custom registrations.Any better suggestion?