locked
Manipulating a SQL query in the Entity Framework Provider RRS feed

  • Question

  • Hello,

    I use Entity Framework Provider for the OData web service.

    My web service needs to limit the total number of entities as 1 million to the maximum.


    One solution in my mind is simple. I can just use one of OData system queries: $top 

    However, WCF adds a 'ORDER BY' clause to the SQL string when it sees '$top' command in the URL.

    (Vitek already answered me about this: http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataservices/thread/a5095bb3-3f1d-443d-ba1f-31239d306c3e)


    Because adding the 'ORDER BY' clause significantly decreases the performance of my data service,

    I want to remove the clause in the SQL string Entity Framework generates.


    Do you have any ideas about removing the clause?

    I think that if I intercept the SQL query which is passed to SQL Server, then I can manipulate the query.

    Another ideas is to change the value of a property having the SQL query, but I don't know yet what a property has the SQL query.


    Merry Christmas and Happy New Year!!!


    Thanks,

    Sung Am YANG





    • Edited by byHesed Friday, December 21, 2012 9:17 AM
    Friday, December 21, 2012 9:15 AM