-
Notifications
You must be signed in to change notification settings - Fork 67
Rename IOptions<TOptions>.Options to .Value #31
Comments
@davidfowl @lodejard @divega with Named options being removed (soon), should we go back to IOptionsAccessor to match IHttpContextAccessor? Or keep it IOptions and just switch it to IOptions.Value? |
Question related to this -- why can't MyOptions be injectable? |
Options are meant to be simple poco data objects. I believe the motivations are similar to why configuration is not put into DI. But the actual initialization of options(IConfigureOptions) are. |
But |
@divega @davidfowl What do you guys think about renaming IOptions to ISharedOptions to convey that this is meant to be used mostly when options are singletons/shared... Its only property would be:
|
Lets keep the name IOptions. It started out as IOptionsAccessor which was inconveniently verbose. @brockallen it is very similar, but the accessor service has advantages in that the creation of the singleton is deferred to when it's first used. Plus it enables the pattern where multiple IConfigureOptions can be added as services to alter any given TOptions. With a singleton MyOptions added to DI it must be fully baked before it is added, and the things doing the options configuration all need to do their work before IOC is available. |
Normally, you declare variables like this:
The text was updated successfully, but these errors were encountered: