I have a complex query which can grow or get smaller depending on which paramaters it receives. Example:
public string CreateQuery(string[] fields)
{
var query = "SELECT student_name,student_last_name FROM students";
if(fields[0]!= "")
{
query += " WHERE studient_id='"+fields[0]+"'";
}
if(fields[1] != null)
{
//them....
}
//and so on
return query;
}
So i need to execute that query like webmatrix
ViewBag.StudentInf = db.Query("Query string here...");
How, then, can I execute a query string with entity Framework??