0

I have a wrapper class for IMongoCollection<T> Collection.
I expose a function for AsQueryable():

public virtual IQueryable<T> AsQueryable()
{
    return Collection.AsQueryable();
}

I need to intercept the execution of queries (start and end of the query) e.g. to catch errors and general logging or log long queries execution times.

How can I achieve that?

GSerg
  • 76,472
  • 17
  • 159
  • 346
Aviko
  • 1,139
  • 12
  • 21
  • 1
    Is the guidance of my answer @ https://stackoverflow.com/questions/41806029/how-to-track-mongodb-requests-from-a-console-application/41812814#41812814 of any help? – Peter Bons Sep 08 '18 at 11:27
  • Hello Peter, thanks a lot, your answer definitely gives me valuable ideas and links to explore. – Aviko Sep 09 '18 at 08:26
  • I found few other related questions: How do I log my queries in MongoDB C# Driver 2.0? https://stackoverflow.com/q/30333925/1544054 , and MongoDB C# Driver: Query interceptors? https://stackoverflow.com/q/48947260/1544054 – Aviko Sep 09 '18 at 08:35

0 Answers0