Replies: 1 comment
-
|
OMG closing - I've already asked this last year :( ref: #57750 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
👋🏻 G'Day all,
Problem
.AddCorsdoesn't make it easy to setup with using values from the "configuration" sources.Details
Can we have an overload for
.AddCorswhich accepts anIServiceProviderso we can then extract registered services from the DI/IoC container like our strongly type configuration values!A common use case when registering services is that we need access to the
IServiceProviderso we can extract Services/RequiredServices that have been registered.Here's a great example -> database:
The beauty of this is that we can read some Configuration information before we start registering our services with DI/IoC. When we need the instance (in this case, some
IDapperContextorMyDbContext) it can grab theIOptionsconfiguration information. Nice 😻Now this is not possible with
.AddCors:(We have to know everything there and then. Can we please have
.AddCorshave an overload:so this way we can grab configuration values from our IOptions which have been previously read/parsed/strongly-typed/registered.
e.g.
thank you ASP.NET Core team! 🍰
Beta Was this translation helpful? Give feedback.
All reactions