ObjectQuery.ToTraceString 方法 ()
用法
int productID = 900; using (AdventureWorksEntities context = new AdventureWorksEntities()) { // Define the object query for the specific product. ObjectQuery<Product> productQuery = context.Products.Where("it.ProductID = @productID"); productQuery.Parameters.Add(new ObjectParameter("productID", productID)); // Write the store commands for the query. Console.WriteLine(productQuery.ToTraceString()); }来自msdn

本文介绍如何使用 ObjectQuery.ToTraceString 方法来获取特定产品的查询对应的 SQL 语句。通过实例展示了如何定义对象查询并输出其对应的数据库命令。

148

被折叠的 条评论
为什么被折叠?



