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

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

Closed
@HaoK

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions