I have a generic function written for Linq to Sql.
Some code is:
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));
}
}
where dc is a DataContext. I am using ObjectContext. q is System.Linq.IQueryable. So inspite of dc.GetCommand(q).CommandText. What should I use know. And similarly for DbParameter. Any help is appreciated.
EF doesn’t have equivalent to
GetCommand. If you want to have access to parameters try to use EF Provider Wrapper (check sample for Tracing).