none
Dynamic linq to sql “GroupBy” query results parsing

    Question

  • I am using Dynamic Linq to sql(microsoft provided dynamic.cs) and created successfully "Groupby" query.

    var Result = le.Table.where(e,value[]).GroupBy("Applicationname","it");

    foreach(var ip in Result)
    {
       
    foreach(var t in ip)
       
    {
           
    //want to do my work
       
    }
    }

    i get list of groups in "ip", but when i run second foreach loop it gives error that "object doesn't not contain a public definition for getenumerator" as i want to go thru each grouped element.

    In debugger I am getting value but don't know how to parse it. I want to view each single entry of each group.

    Pls Help

    Thanks

    Thursday, November 07, 2013 8:03 AM

Answers

  • Hello,

    The ‘var’ will not tell us what type the entity is. We need to specify it explicitly like below:

    var result = db.Orders.AsQueryable();
    
    
                    foreach (Order o in result)
    
                    {
    
                        foreach (OrderDetail or in o.OrderDetails)
    
                        {
    
    
                        }
    
                    }
    

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, November 08, 2013 9:12 AM

All replies

  • Hi Crazyones,

    I'm moving your question to Linq to SQL forum for better responses.

    Thanks for your understanding.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, November 08, 2013 8:12 AM
  • Hello,

    The ‘var’ will not tell us what type the entity is. We need to specify it explicitly like below:

    var result = db.Orders.AsQueryable();
    
    
                    foreach (Order o in result)
    
                    {
    
                        foreach (OrderDetail or in o.OrderDetails)
    
                        {
    
    
                        }
    
                    }
    

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, November 08, 2013 9:12 AM