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

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

Activity

  1. self-assigned this
    on Jan 18, 2017
  2. added this to the 2.0.0 milestone on Jan 18, 2017
  3. HaoK commented on Feb 13, 2017

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions