Skip to content
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 opened this issue Jan 18, 2017 · 1 comment
Closed
Assignees

Comments

@HaoK
Copy link
Member

HaoK commented Jan 18, 2017

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

@HaoK
Copy link
Member Author

HaoK commented Feb 13, 2017

c68ede3

@HaoK HaoK closed this as completed Feb 13, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant