Please add non generic base or interface to Response<T>.
See original GitHub issueIs your feature request related to a problem? Please describe. I am trying to implement a common way to emit diagnostics data from cosmos response object, however it seems like I cannot do it without reflection.
Describe the solution you’d like If https://github.com/Azure/azure-cosmos-dotnet-v3/blob/c5a5b8836aa8ce2f8d93a863f4abdb2d2818fa5b/Microsoft.Azure.Cosmos/src/Resource/Response.cs had a non generic base with all the properties but Resource, I could cast the response I receive to Response object and access Diagnostics property without needing to use reflection in a generic method that wraps logging of diagnostics. An alternative would be to add an interface like IResponse or something like that.
Describe alternatives you’ve considered I considered alternative code design but none of it solved the situation as simple and straightforward as having non generic Response base class.
Additional context Add any other context or screenshots about the feature request here. I am running a method that takes a Func<TResult> to execute a cosmos request:
TResult result = await func();
In my use case, TResult
is always Response<T>
. Before I return the result
I would like to dump some diagnostics and emit some metrics about usage etc… If the base was not Response<T>
but something like IResponse
then I could easily do something like this (IResponse)result.Diagnostics
to access diagnostics without using reflection.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
You are right, they are virtual. It seems I was not paying enough attention there, my bad.
Closing due to in-activity, pease feel free to re-open.