EntityFramework-Extensions icon indicating copy to clipboard operation
EntityFramework-Extensions copied to clipboard

UpdateFromQueryAsync with DbCommandInterceptor

Open doron-legit opened this issue 1 year ago • 2 comments

Description

I tried using DbCommandInterceptor (both "Microsoft.EntityFrameworkCore.Diagnostics" and "Z.EntityFramework.Extensions") when calling UpdateFromQueryAsync to get the DbCommand—still, neither works (I override all the possible functions like in this example: https://entityframework-extensions.net/command-interception-in-ef-core). I can get the callbacks from other operations like Select or Count, but not when calling to UpdateFromQueryAsync. What do you think I should do?

Further technical details

  • EF version: [EF Core v8.0.3]
  • EF Extensions version: [EFE Core v8.101.2.1]
  • Database Server version: [PostgreSQL 15.3]
  • Database Provider version (NuGet): [Npgsql.EntityFrameworkCore.PostgreSQL 8.0.0]

doron-legit avatar Jun 03 '24 12:06 doron-legit

Hello @doron-legit ,

Unfortunately, our library doesn't use an interceptor at this time.

We tried a few months ago, but it was still too much complicated. It might eventually changes but we don't have any short term plan to make it happens.

However, since EF Core 7, they now support ExecuteUpdate, which is very similar to our UpdateFromQuery. So perhaps looking at the method provided by EF Core itself could solve your issue.

Best Regards,

Jon

JonathanMagnan avatar Jun 03 '24 15:06 JonathanMagnan

Okay, I will try to use ExecuteUpdate; I would suggest adding this limitation to the docs. Thank you

doron-legit avatar Jun 04 '24 06:06 doron-legit