linq to sql using crm early bound classes RRS feed

  • Question

  • Hi all,

    i am using subselect query for  salesorder entity has new_sefer field. My query is

    (from d in context.SalesOrderDetailSet
                    where context.SalesOrderSet.Where(s => s.new_Sefer.Id == Id)
                    .Select(i => i.SalesOrderId).Contains(d.SalesOrderId.Id)
                    select d).Count();

    it throws this exception : "Invalid 'where' condition. An entity member is invoking an invalid property or method."

     I have also question about subselect queries

    how can i write this sql query using linq to sql

    select count(*) from salesorderdetail 
    where salesorderId in (select salesorderId from salesorder 
                          where new_sefer = '750FEB6F-F742-E311-8F56-000C29F3049E')  

    Any help appreciated :-)

    • Edited by Enes Albay Friday, November 1, 2013 9:13 PM deleted unnecessary part
    Friday, November 1, 2013 9:06 PM