Search code examples
linqpad

Which LINQPad driver should I use?


I am connecting to a Microsoft SQL Server hosted on Azure.

I have the following two LINQPad driver options:

  • LINQ to SQL (optimized for SQL Server)
  • Entity Framework Core (multi-provider)

Both works, but which driver should I use?


Solution

  • The short answer is that the LINQ-to-SQL driver is likely to provide a better experience unless you need a feature specific to EF Core.

    Long answer:   The cold startup time with the LINQ-to-SQL libraries is around 2.5x faster than EF Core. This means that when you execute a query for the first time, the results will appear more quickly with LINQ-to-SQL. This can make a difference with features such as right-clicking a table in Schema Explorer and choosing 'View/Edit top x rows in Grid' (which creates a new query and executes it on one step).

    The LINQ-to-SQL driver also directly supports Azure interactive authentication (including MFA) and includes an option to securely save tokens to disk, so you don't have to re-authenticate after restarting LINQPad. It also supports stored procedures, system views, and lets you query multiple databases at the same time (on the same server or on linked servers).

    The only major reason to use the EF Core driver with Azure is if you need a feature that's available only with EF Core, or you want your queries to have complete compatibility with that API. Keep in mind, however, that in either case, the scaffolding is performed by LINQPad and so you will end up with the same object schema (apart from no stored procs, system objects or multiple databases in the case of EF Core).