[英]Equivalent of GetCommand() function of (Linq to Sql) in (Linq to Entity)
我有一个为 Linq to Sql 编写的通用函数。
一些代码是:
string sqlCmd = dc.GetCommand(q).CommandText;
{
foreach (System.Data.Common.DbParameter dbp in dc.GetCommand(q).Parameters)
{
cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter(dbp.ParameterName, dbp.Value));
}
}
其中 dc 是一个 DataContext。 我正在使用 ObjectContext。 q 是 System.Linq.IQueryable 。 所以尽管 dc.GetCommand(q).CommandText 。 我应该用什么知道。 与DbParameter类似。 任何帮助表示赞赏。
EF 没有等效于GetCommand
。 如果您想访问参数,请尝试使用EF Provider Wrapper (检查示例以获取跟踪)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.