Open
Description
There appears to be very little documentation on the new TimeProvider
functionality. I had to go google around to see how this thing was expected to be registered in the DI.
Eventually I did find that I had to do this:
services.TryAddSingleton(TimeProvider.System);
Sadly, this doesn't seem to be documented anywhere. It might be good to at least mention it as a remark on the System.TimeProvider page.
Additionally, I think it would make sense to provide an extension method on IServiceCollection
along the lines of AddTimeProvider()
, like for example AddHttpContextAccessor()
and AddMemoryCache()
.