locked
Convert IQueryable to List<T> type RRS feed

  • Question

  •  
    I just performed a query with LINQ from the DAL and got a collection of a record with imbedded ILIST objects like the following:

    string name
    date   startDate
    date  endDate
    ILIST<MyType> ImbeddedList (this contains more columns like recordID, sentDate, dueDate)I need to return a LIST<T> back to the grid to be bounded.

    I am having some problems with writing the LINQ statement to filter out the IQueryable collection object.

    In my statement below:

    IQueryable<ALl_DATA> cases = dalObject.GetData();
    var mylist = cases.Select(s => {s.name, s.startDate, s.endDate,s.ImbeddedList????}).ToList();

    When I get to the ImbeddedList, which is returned from the dalObject, the intellsense does not show the fields in the ImbeddedList.
    How can I correctly write the LINQ statement to filter for more fields in the ImbeddedList object?

    For my test linq query, I write something like this:


      GridList = new List<blData>();
      GridList.Add(new blData() { NAME = "Communications LLC", RECORD_UID = "477264", DATE_SENT = DateTime.Now, DATE_DUE = DateTime.Now });


    So, I am trying to use the linq statement now to query the ORM and do additional business logic filter to get specific fields/column from
    ILIST embedded object.

    Any help is greatly appreciated.

    Tuesday, November 27, 2012 9:07 PM