Skip to content

Emphasize IOptionsMonitor as the recommended choice #9662

Closed

Description

@HaoK

@DamianEdwards brought up a good point recently that our options docs don't make it clear enough that IOptionsMonitor is the recommended choice going forward, since its effectively everything IOptions is but more...

@guardrex can you help me add this guidance?

I think maybe we just add a section that says something like this:

Which options interface to use?

IOptionsMonitor is generally recommended as the interface to use because it supports everything IOptions does, in addition to supporting named options, reloadable configuration, change notifications, as well as the ability to selectively invalidate instances via the IOptionsMonitorCache. (Note: these should be links to appropriate doc sections)

IOptionsSnapshot is a good alternative for scenarios where options should be recomputed on every request.

IOptions is really the only choice when using existing frameworks/libraries that are already using IOptions

Activity

  1. self-assigned this
    on Nov 21, 2018
  2. added this to the 2018 Q 4 ends Dec 31 milestone on Nov 21, 2018
  3. guardrex commented on Nov 21, 2018

    @guardrex
    Collaborator

    @HaoK IOptions is the featured interface in the text and sample app for:

    • Simple options access
    • Set simple options with a delegate
    • Suboptions
    IOptions<MyOptions> optionsAccessor, 
    IOptions<MyOptionsWithDelegateConfig> optionsAccessorWithDelegateConfig, 
    IOptions<MySubOptions> subOptionsAccessor, 

    Should I refactor these scenarios to use IOptionsMonitor and move IOptionsMonitor coverage to the top of the topic along with the section you suggest?

  4. HaoK commented on Nov 21, 2018

    @HaoK
    MemberAuthor

    Yeah I guess so, it doesn't really matter which interface is used for those examples

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions