2
我有一个为Linq to Sql编写的通用函数。(Linq to Entity)中(Linq to Sql)的GetCommand()函数的等效
一些代码是:
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。任何帮助表示赞赏。