我想翻譯的查詢是:轉換T-SQL查詢到LINQ
SELECT
Products.id, [Products].Name
FROM
[Products]
LEFT JOIN
[AvailableProducts] ON [AvailableProducts].IdProduct = [Products].Id
AND [AvailableProducts].IdUser = 'daa8ee71-f1d7-4b41-aa1c-464ae730dd63'
WHERE
([AvailableProducts].IdProduct IS NULL)
我試圖解決這個問題,這樣的Linq代碼:
public void DataBindGriedProducts(string idUser)
{
List<Product> data = new List<Product>();
var con = from test in db.AvailableProducts
join product in db.Products on new { test.IdProduct, test.IdUser} equals new { product.Id, idUser}
select new
{
surname = product.Name,
};
grdConnectedProduct.DataSource = data;
grdConnectedProduct.DataBind();
}
但它不是正確。請幫幫我!