Open
Description
@davidfowl, Constructors section explains getting around by using static factory pattern.
But, what happens when I cannot call this static method to create an instance because the instance is created by container when IService
is dependency injected via constructor into other class?
Basically, what is the best practice for calling Async method in within constructor for these 2 different scenarios?
- Need to wait for the Async method in ctor to finish before moving forward
- Fire and forget to loading some collections asyncronously
- I guess this will be similar to Async void i.e.
Task.Run(BackgroundOperationAsync);
?
- I guess this will be similar to Async void i.e.
Metadata
Assignees
Labels
No labels
Activity