3

Is it possible to intercept a query to a DB from the EF in the EF version which is lower than the 6?

According to the documentation over here the interception is only possible in EF6, is it so?

iloveseven
  • 605
  • 4
  • 18
  • As an alternative you could use [extended events](https://learn.microsoft.com/en-us/sql/relational-databases/extended-events/quick-start-extended-events-in-sql-server?view=sql-server-ver15) to audit generated queries – Lukasz Szozda Oct 17 '19 at 21:03
  • @LukaszSzozda, could you elaborate a little bit more on the topic, please? Maybe there is a documentation or examples about what you are talking? Thank you. – iloveseven Oct 17 '19 at 21:04
  • Sure added link to doc. Please refresh the page – Lukasz Szozda Oct 17 '19 at 21:04
  • @LukaszSzozda, hm. Does it mean that I am intercepting the queries not on the application side, but on the DBMS side? Or am I missing something here? – iloveseven Oct 17 '19 at 21:07
  • Yes, this mechanism is 100% DB side, independent of used client code – Lukasz Szozda Oct 17 '19 at 21:09
  • 1
    @LukaszSzozda, if you post you comments as an answer, then I will accept it. Thank you. – iloveseven Oct 17 '19 at 21:13

1 Answers1

2

As an alternatvie you could use extended event session to track issued queries. It is purely database solution and it is indepenedent of your application code.

Extended Events is a lightweight performance monitoring system that uses minimal performance resources. Extended Events provides two graphical user interfaces to create, modify, display, and analyze your session data.

More info: Quicstart: Extended events in SQL Server

Lukasz Szozda
  • 162,964
  • 23
  • 234
  • 275