Closed dandanlen closed 4 years ago
Just want to add that if this is ever implemented, it would be good to also add a check of a CancellationToken
before running Explore
so that cancellation are automatically propagated through all components.
Currently in the ExplorerComponent
abstract base class we have:
public Task<TResult?> ResultAsync => componentTask ??= Task.Run(async () => await Explore());
This could be replaced with (pseudo-code..):
public Task<TResult?> ResultAsync => componentTask ??= Task.Run(async ()
{
// DependentComponents is an IEnumerable<ResultProvider> generated using reflection.
await Task.WhenAll(DependentComponents.Select(async c => await c.ResultAsync));
cancellationToken.ThrowIfCancellationRequested();
await Explore();
});
It might be nice to have the exploration abort logic integrated with the
ExploreComponent
base class.See https://github.com/diffix/explorer/pull/262#pullrequestreview-464107973
The main difficulty might be supporting multiple required components with different types etc, while maintaining enough type information for dependency injection... this might require either some compile-time magic or runtime introspection.