async/await in service registration or service resolution. #2353
Labels
enhancement
This issue represents an ask for new feature or an enhancement to an existing one
Milestone
From @Antaris on Wednesday, October 14, 2015 3:10:50 AM
Is it possible to support
async
/await
andTask
based service resolution? I'll walk you through an example:In my example above, I'm defining some implementations of abstractions provided by my framework. In a dependency, the
ISecurityContextFactory
I implement aTask
-based async/await model because I don't know that the actual implementation might do some DB work to say load the current user information.When I come to wire up my services, I want to utilise my
WorkContextFactory
to build my type (seperation of concerns), so I might do something like the following:Obviously at the moment, I'm having to block until I get the result of
Task<IWorkContext>
, but it would be great if I could do something like:And have the DI system understand the
Task
result and await.Is this possible?
Copied from original issue: aspnet/DependencyInjection#303
The text was updated successfully, but these errors were encountered: