Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add doc section:Enable using a Cookie Session Store from DI #5922

Closed
Rick-Anderson opened this issue Apr 10, 2018 · 4 comments
Closed

Add doc section:Enable using a Cookie Session Store from DI #5922

Rick-Anderson opened this issue Apr 10, 2018 · 4 comments
Labels
Pri3 Priority 3
Milestone

Comments

@Rick-Anderson
Copy link
Contributor

Rick-Anderson commented Apr 10, 2018

From aspnet/Security#1719

@HaoK

we should have an explicit section recommending this pattern of how to configure options instances with things from DI in this doc maybe? https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options

public class UseSomethingFromDI : IConfigureNamedOptions/IConfigureOptions<YourOptions> {
       public CookieConfig(ISomethingFromDI thing) => _thing = thing;
       public void Configure([string name,] YourOptions o) { o.Thing = thing; }
   }
   services.AddTransient<IConfigureOptions<YourOptions>, UseSomethingFromDI>();
@HaoK
Copy link
Member

HaoK commented Apr 10, 2018

We can also demonstrate a new in 2.1 API ConfigureOptions here as well maybe:

services.ConfigureOptions<UseSomethingFromDI> instead of services.AddTransient<IConfigureOptions<YourOptions>, UseSomethingFromDI>();, this uses reflection to basically do the same thing and also lets UseSomethingFromDI configure multiple option types if desired.

@HaoK
Copy link
Member

HaoK commented Apr 10, 2018

Maybe this should go into a separate bug, but another good 2.1 options feature to doc eventually is the new IOptionsBuilder and related overloads, see aspnet/Security#1718 (comment) its related to this general idea of being able to more easily configure options with things from DI

@scottaddie scottaddie modified the milestones: 2018 - Quarter 2, Backlog Jul 10, 2018
@Rick-Anderson Rick-Anderson added the Pri1 High priority, do before Pri2 and Pri3 label Oct 26, 2018
@Rick-Anderson
Copy link
Contributor Author

IOptionsBuilder was documented here

Moved to #10392

@Rick-Anderson
Copy link
Contributor Author

@guardrex isn't this a dup of #10392
If so, copy over what you need and close this.

@Rick-Anderson Rick-Anderson added Pri3 Priority 3 and removed Pri1 High priority, do before Pri2 and Pri3 labels Jan 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Pri3 Priority 3
Projects
None yet
Development

No branches or pull requests

4 participants