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

Add support for named options #7

Closed
HaoK opened this issue Sep 18, 2014 · 6 comments
Closed

Add support for named options #7

HaoK opened this issue Sep 18, 2014 · 6 comments

Comments

@HaoK
Copy link
Member

HaoK commented Sep 18, 2014

        SetupNamedOption("ApplicationCookie", options => { })
        UseCookieAuthentication("ApplicationCookie")
        SetupNamedOption("ExternalCookie", options => { })
        UseCookieAuthentication("ApplicationCookie")

        // Overloads which use default/no name
        SetupOption(options => { })
        UseGoogleAuthentication()

Add Name/GetNamedOptions to IOptionsSetup/OptionsAccessor

@lodejard
Copy link

Also the

    public interface IOptionsConfiguration<in TOptions>
    {
        int Order { get; }
        void Setup(TOptions options);
    }

should probably take void Setup(string name, TOptions options); - I recall we talked about adding a property string Name, but it would be more flexible to let the component decide if the name applies or not

@HaoK
Copy link
Member Author

HaoK commented Sep 20, 2014

@lodejard If we didn't have a Name property on the IOptionsConfiguration, how would we filter based on Name before applying them? Is the idea that instead that the default OptionsConfiguration class would take the targetName in the constructor and only execute the action if the name matches during setup?

@lodejard
Copy link

Yep

@HaoK
Copy link
Member Author

HaoK commented Sep 24, 2014

Updated the PR with the change to take names in Setup, can you review? #15

@divega
Copy link

divega commented Oct 9, 2014

We ended up using a property for Name and not having the name argument from the method that applies the Action. This is the simplest design that allows deterministically executing unnamed options before matching named options for the same Order. We are keeping this item open so that we can reconsider this later, e.g. if we still believe that it is compelling to build more flexibility into the name matching logic, we should also consider providing a way to compare two instances of IOptionAction in order to sort them correctly, e.g. we could have IOptionAction implement IComparer and then OrderBy(s => s) should pick it up automatically.

@HaoK
Copy link
Member Author

HaoK commented Oct 14, 2014

#21

@HaoK HaoK closed this as completed Oct 14, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants