I'm trying to test out a dynamic join extension method as defined here to join products with categories in the Northwind SQL database. However I'm not 100% familiar with lambda expressions and fail to understand how to make the following SQL query using this extension method
select * from dbo.Products p
join dbo.Categories c on c.categoryID = p.CategoryID
where p.CategoryID =3 and UnitPrice > 3
Here is my dynamic linq query.
var queryProducts = northwind.Products
.Where("CategoryID = 3 AND UnitPrice > 3")
.OrderBy("SupplierID");
var queryCategory = northwind.Categories
.Where("CategoryID=3")
.AsEnumerable();
var queryJoin = queryProducts.Join(queryCategory, "CategoryId", "CategoryId", "new(1 as abcd)",null);
This fails with exception: "An exception of type 'System.InvalidOperationException' occurred in System.Core.dll but was not handled in user code
Additional information: No method 'Join' on type 'System.Linq.Queryable' is compatible with the supplied arguments."
Any ideas on how to modify the Join above to make it work?