ExecuteUpdate and ExecuteDelete

Since the release of .NET Core 7 EF Core support both mass delete and mass update without first loading the data.

Today we use
var toBeDeleted=SomeEntity.Where(x=>x.SomeField=="a").DumpTell();
which causes a SQL DELETE Statement for each item in the result of the query "toBeDeleted" - which works OK - but can be VERY slow if there are many items,

EF Core 7+ now supports

How can I use that in LINQPad 8?

  • I tried the LINQ to DB Connection. But 1.) It references some vulnerable NuGet Packages. And as far as I know they have not ported this new feature yet.
  • I tried the built-in default LINQ to SQL Connetion - but it appears this has not been ported. Maybe I missed something.
  • I tried the built-in Entity Framework Core Connection: but it can not connect to Azure SQL - does it?
    Anyone an idea?


  • Ok I figured it out myself. First create a connection using the LINQPad Connection. In the dialog enter all required connection parameters (easy) and use button Test to verify it works. Click on button Advanced and click on "Copy full connection string to clipboard". You can either cancel the connection or save as alternative.

    Then create a new connection using Entity Framework Core. This automatically parse the connection string in the clipboard and transfer it to the new dialog fields. Bingo.

  • Or you can also simply set the "Extra connection string options" to
    connect timeout=30;trust server certificate=False;authentication=ActiveDirectoryInteractive;application intent=ReadWrite;multi subnet failover=False
    and fill out the server yourself. Do not use Windows authentication and enter your Entra Id user principal name as User ID.

    All a little tedious. It would be great if there was a button "Same parameters, different driver" for an existing connection (with maybe a message in case some settings that work for driver A do not work for driver B).

  • Note that the "Active Directory Interactive" connection string option is a practical solution only if the credentials are managed by Windows Single-Sign-On (otherwise it will keep re-prompting). Improving this is on the TODO list.

Sign In or Register to comment.