Open jdaigle opened 4 years ago
I'm a little confused what the source of this data would be, since we're an ADO.NET wrapper - what's the input on the number of rows from DbDataReader
?
@NickCraver my thought is simply a counter that is incremented each time DbDataReader.Read()
or DbDataRader.ReadAsync()
is called and returns true
.
So my design question is which class owns this counter?
IDbProfiler
. I think that would require a new IDbProfiler.ReaderRead(IDataReader reader)
method that is called by ProfiledDbDataReader each time a row is read. As I mentioned above, this might be pretty expensive given how it uses a dictionary to maintain state for multiple readers.ProfiledDbDataReader
uses its own counter. Then add a new parameter to IDbProfiler.ReaderFinish(IDataReader reader, int numberOfRowsRead)
to save off the result.I would like to see returned number of rows from sql. Did you found solution for that?
I'm considering a feature to count the number of rows read by a profiled IDataReader as a new property on CustomTiming. I'm looking for feedback on whether or not this seems useful, and to discuss a possible design for the feature (I'm happy to spend the time building it).
A couple of ideas:
IDbProfiler.ReaderRead(IDataReader reader)
that increments a NumberOfRowsRead property. While this is pretty clean, it's probably not very performant since the current implementation of IDbReader would require a dictionary lookup.IDbProfiler.ReaderFinish(IDataReader reader)
so that it includesint numberOfRowsRead
.Both of these, unfortunately, are breaking changes to the interface. But how many people are implementing custom
IDbProfiler
implementations?I'm open to to other ideas too.