Closed JimBobSquarePants closed 4 years ago
Hi @JimBobSquarePants..
Overall seems like a good idea. The only thing I don't like is if we have to know the IOptions<T>
all over our own codebase.
I'm sure there is a way to get the best of both worlds.
E.g https://www.strathweb.com/2016/09/strongly-typed-configuration-in-asp-net-core-without-ioptionst/
I think that post is a little naïve and doesn't take into account any of the the highlighted benefits of IOptions<T>
and co.
Having IOptions<T>
passed to your constructors isn't a bad thing. As I noted before.
It's common convention. No surprises for future contributors.
We decide to allow the MS Config interfaces in Umbraco.Core
. @AndyButland already started a draft PR. Good start, and we can continue on work.
I think we should make a netcore/config
branch as the base branch for all these smaller config PRs, so we can merge these into netcore/netcore
as one big PR, but review it as several smaller PRs.
Hi @JimBobSquarePants,
We're writing to let you know that we would love some help with this issue. We feel that this issue is ideal to flag for a community member to work on it. Once flagged here, folk looking for issues to work on will know to look at yours. Of course, please feel free work on this yourself ;-). If there are any changes to this status, we'll be sure to let you know.
For more information about issues and states, have a look at this blog post
Thanks muchly, from your friendly Umbraco GitHub bot :-)
Can we/should we close this now @bergmania? Seems that any further uses of IOptions
will come in as and when new features are migrated, rather than being a separate task to add.
Current .NET Core configuration utilizes a non-conventional pattern to load configuration values.
https://github.com/umbraco/Umbraco-CMS/blob/43efee9647ed8f2eaab3ec2b71d3dd3eb46b9017/src/Umbraco.Configuration/AspNetCoreConfigsFactory.cs
ASP.NET Core already has an established pattern to load options. https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options?view=aspnetcore-3.1
There are several advantages to using this pattern.
Binding a section becomes trivial.
Consuming it equally so.
Unit testing again is trivial.