locked
EF LINQ Query Problems RRS feed

  • Question

  • I have a simple LINQ query across my Entity Framework model like this:

     

     

    var result1 = from p in ctx.Parts
                   where p.DamageLine.RepairJob.ShopId == "1002"
                   select p;

    The problem with this is that it can take up to 50+ seconds to bring back 11 Parts records. I looked at the SQL output and it's selecting not only all the fields from Parts (which it should) but also including the DamageLine and RepairJob fields.

    Any ideas?

    David McCarter


    Microsoft MVP
    Friday, October 1, 2010 6:30 PM

Answers

  • Hi,

    Since you posted this question to a WCF Data Services forum... do you run the above query through a WCF Data Services client over a server which uses EF as the provider for WCF Data Services, or is it really a direct query against an EF context. I guess a simple way to ask: the ctx variable, is it of type DataServiceContext or ObjectContext?

    Thanks,


    Vitek Karas [MSFT]
    Friday, October 1, 2010 7:26 PM
    Moderator

All replies

  • Hi,

    Since you posted this question to a WCF Data Services forum... do you run the above query through a WCF Data Services client over a server which uses EF as the provider for WCF Data Services, or is it really a direct query against an EF context. I guess a simple way to ask: the ctx variable, is it of type DataServiceContext or ObjectContext?

    Thanks,


    Vitek Karas [MSFT]
    Friday, October 1, 2010 7:26 PM
    Moderator
  • Hi David,

     

    I am writing to check the status of the issue on your side.  Would you mind letting us know the result of the suggestions? 

     

    If you need further assistance, please feel free to let me know.   I will be more than happy to be of assistance.

     

    Have a nice day!

     

     

    Best Regards,
    Lingzhi Sun

    MSDN Subscriber Support in Forum

    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Monday, October 11, 2010 1:22 AM
    Moderator