Is LeftJoin extension method supported?
I'm running a simple query using .NET 10 and C# statement in one of my local dbs, the query is meant to join two tables using left join I get an error stating "Query Operator "LeftJoin" not supported"?

Wasn't LinqPad 9 supposed to support .NET 10 and C# 14?
Answers
-
If you need to use the new LeftJoin/RightJoin operators, create an EF Core connection instead of a LINQ-to-SQL connection.
Note that LeftJoin/RightJoin operators are redundant noise in LINQ if a foreign key constraint exists. Instead, do this:
from p in Purchases select new { p.Description, p.Customer.Name }LINQ-to-SQL will automatically translate this into a LEFT OUTER JOIN if the CustomerID column in Purchases is nullable:
SELECT [t0].[Description], [t1].[Name] FROM [Purchase] AS [t0] LEFT OUTER JOIN [Customer] AS [t1] ON [t1].[ID] = [t0].[CustomerID]
Much easier than joining manually.
-
I've included LeftJoin/RightJoin support in the new LINQ-to-SQL drop in 9.10.7, so if you still want to use that in LINQ-to-SQL, you now can.
Enhanced LINQ-to-SQL features
Support for modern column types
- DateOnly / TimeOnly (can be disabled on the Options tab)
- SqlGeometry, SqlGeography and SqlHierarchyId
- JSON and Vector (SQL Server 2025)
The
SqlMethodsclass includes static methods to operate on JSON/Vector columns, such asJsonValue,JsonContainsandVectorDistance.Additional query operators
Order,OrderDescendingLeftJoin/RightJoinCountBy,MinBy,MaxBy,DistinctBy,UnionBy,ExceptBy,IntersectByElementAt,ElementAtOrDefaultLast,LastOrDefaultReverse,Shuffle
Bulk operations and query shaping
ExecuteUpdate/ExecuteDeleteperform set-based updates and deletes in a single round-trip without loading entities (same semantics as EF Core).string.Joinover a grouping is translated to SQL Server'sSTRING_AGGfunction.TagWithannotates the generated SQL with a comment.WithQueryHintsinjects query hints such asOPTIMIZE FOR UNKNOWN.
Support for Microsoft.Data.SqlClient
Microsoft.Data.SqlClientis used by default for new connections.System.Data.SqlClientis supported via a checkbox in the Options tab.
-
Re TagWith
I had previously changed a query to EF in order to use TagWith, so I tried switching back to Linq2Sql to try this out and got a few runtime errors.
An example using the NorthWind Database is
this.CurrentProductList.TagWith("CurrentProductList").Dump();which throws InvalidOperationException: Sequence contains more than one element
The Sql tab shows
-- CurrentProductList
SELECT NULL AS [EMPTY]
GOSELECT [t0].[ProductID], [t0].[ProductName]
FROM [Current Product List] AS [t0]Also, can you add TagWithCallSite as well? (I know it should be trivial to write my own extension method, but I'm not sure how to add it to My Extensions without interfering with non-linq2sql query)
-
Thanks - this is now fixed, and TagWithCallSite has been added.
-
@JoeAlbahari said:
Thanks - this is now fixed, and TagWithCallSite has been added.Thanks again
-
Thanks @JoeAlbahari
