EF code first 能执行普通的多表left join SQL语句,返回datatable吗
以前我没有用过EF, 用动软代码生成器, 执行多表SQL语句 返回datatable,直接就以下方法
public static DataSet Query(string SQLString, int Times)
{
using (SqlConnection connection = new SqlConnection(factorychoice()))
{
DataSet ds = new DataSet();
try
{
connection.Open();
SqlDataAdapter command = new SqlDataAdapter(SQLString, connection);
command.SelectCommand.CommandTimeout = Times;
command.Fill(ds, "ds");
}
catch (System.Data.SqlClient.SqlException ex)
{
throw new Exception(ex.Message);
}
return ds;
}
}
如果用EF codefirst,是否也可以执行普通的SQL语句,谢谢大家。