What is the return type for a anonymous linq query select? What is the best way to send this data ba

Posted by punkouter on Stack Overflow See other posts from Stack Overflow or by punkouter
Published on 2010-06-09T21:37:41Z Indexed on 2010/06/09 21:42 UTC
Read the original article Hit count: 290

This is a basic question. I have the basic SL4/RIA project set up and I want to create a new method in the domain service and return some data from it. I am unsure the proper easiest way to do this.. Should I wrap it up in a ToList()? I am unclear how to handle this anonymous type that was create.. what is the easiest way to return this data?

 public IQueryable<ApplicationLog> GetApplicationLogsGrouped()
    {
        var x = from c in ObjectContext.ApplicationLogs
                let dt = c.LogDate
                group c by new { y = dt.Value.Year, m = dt.Value.Month, d = dt.Value.Day } into mygroup
                select new { aaa = mygroup.Key, ProductCount = mygroup.Count() };

        return x;


        // return this.ObjectContext.ApplicationLogs.Where(r => r.ApplicationID < 50);
    }

Cannot implicitly convert type 'System.Linq.IQueryable<AnonymousType#1>' to 'System.Linq.IQueryable<CapRep4.Web.ApplicationLog>'. An explicit conversion exists (are you missing a cast?) 58 20 CapRep4.Web

© Stack Overflow or respective owner

Related posts about LINQ

Related posts about linq-to-entities