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
-
👋🏻 G'Day all,
Problem
.AddCors
doesn't make it easy to setup with using values from the "configuration" sources.Details
Can we have an overload for
.AddCors
which accepts anIServiceProvider
so 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
IServiceProvider
so 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
IDapperContext
orMyDbContext
) it can grab theIOptions
configuration information. Nice 😻Now this is not possible with
.AddCors
:(We have to know everything there and then. Can we please have
.AddCors
have 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