Skip to content
This repository was archived by the owner on Nov 7, 2018. It is now read-only.
This repository was archived by the owner on Nov 7, 2018. It is now read-only.

IOptionsSnapshot should support scoped IConfigureOptions (ie. DbContext) #160

Closed
@HaoK

Description

@HaoK

Consuming a DbContext to configure options per request should be possible via.

   public class DbConfigure : IConfigureServices<MyOptions> {
       public DbConfigure(DbContext context) { Context = context; }
       public Configure(MyOptions options) {
           UseContextToConfigure(options);
       }
   }

   services.AddScoped<IConfigureService<MyOptions>, DbConfigure>();

This doesn't work today because we are caching the options until a change evicts (which works for the singleton IOptions but blocks this scenario)

cc @divega @glennc

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions