When adding a DbContext
to your service container via AddDbContextPool
, it appears that you can only use a constructor with a single argument of DbContextOptions<YourDbContextImplementation>
.
To get a TelemetryClient
in .NET Core 3+, it is NOT recommended (aka deprecated) to instantiate TelemetryClient
with 'new'.
Given these two constraints, how can one get a TelemetryClient
when you cannot get one via Constructor DI?
A potential use case would be a Metric to track how many DbContext
are created.
(I am currently using EF Core 2.4 due to pending updates to handle the breaking client-side evaluation changes in 3)