You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I've noticed that after Query is converted via ToLinqToDB, the IDbCommandInterceptor registered will not be run, is there a way to resolve that? We're currently using DbCommandInterceptor to append sp_set_session_context to each query
The text was updated successfully, but these errors were encountered:
ghost
changed the title
IDbCommandInterceptor do not run
Registered IDbCommandInterceptor's do not run
Aug 15, 2022
Its an expected behavior - the IDbCommandInterceptor is an Ef Core interceptor type. Linq2Db uses its own interceptor types. You have to register Linq2Db interceptors in order for interceptors to work after converting query to Linq2Db. Look at InterceptorTests class (https://github.com/linq2db/linq2db.EntityFrameworkCore/blob/e4d2abcb3cbeda79d6056530e9f5cd6daeba304c/Tests/LinqToDB.EntityFrameworkCore.SQLite.Tests/InterceptorTests.cs) for an examples of how to accomplish this.
Especially look at the UseEfCoreRegisteredInterceptorsIfPossible extension used in these tests - it allows to register EF Core interceptor classes for Linq2Db as long as they implement both EF Core and Linq2Db interceptor interfaces,
Hi, I've noticed that after Query is converted via
ToLinqToDB
, theIDbCommandInterceptor
registered will not be run, is there a way to resolve that? We're currently usingDbCommandInterceptor
to appendsp_set_session_context
to each queryThe text was updated successfully, but these errors were encountered: