As I said, I think the best way to do such a query at the moment is to use our ADO API. Your implementation could look like the following scenario.
private static void Sample2()
// 1. Create a new instance of the OpenAccessContext.
using (EntitiesModel dbContext = new EntitiesModel())
// 2. Retrieve the OAConnection instance.
OAConnection oaConnection = dbContext.Connection;
// 3. Create a string containing the sql query.
string sqlQueryString = "YOUR COMPLEX QUERY HERE";
// 4. Create a new instance of the OACommand class.
using (OACommand oaCommand = oaConnection.CreateCommand())
// 5. Set the CommandText property.
oaCommand.CommandText = sqlQueryString;
// 6. Execute the command.
using (DbDataReader reader = oaCommand.ExecuteReader())
// 7. Materialize the reader.
> myResult = dbContext.Translate<
To your question regarding the foresight of the performance outcome. In general, there is no rule which says: "If you do something in that way, you will always have performance problems".
This is generally always dependent on the specific situation.
After looking again at you SQL query, wouldn't it be possible rewrite your query that it might look like this example?
[t4].[OrderID] = [t5].[OrderID]
[t6].[ProductID] = [t5].[ProductID]
[t7].[CategoryID] = [t6].[CategoryID]
Using this pattern might lead to a faster query execution on the server side. Combined with the ADO API way, you should have your results as fast as possible.
Feel free to ask if you have any other question.
the Telerik team
Sharpen your .NET Ninja skills
! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>