Filtering problem when using IQueryable

Thread is closed for posting
2 posts, 1 answers
    FISCAL avatar
    91 posts
    Member since:
    May 2010

    Posted 15 Jul 2010 Link to this post


    I am using IQueryable approach to create dynamic query. All seems okay apart from OpenAccess not supporting something like..

      if (m_dataContext.Transaction.IsActive == false) m_dataContext.Transaction.Begin();
                IQueryable<AdmAudit> audits = m_dataContext.Extent<AdmAudit>();
                if (dateTo.HasValue)
                    //Convert.ToDateTime is not supported in where clause to it needs to be converted before passing it
                    //OpenAccess implementation lacking
                    dateTo = Convert.ToDateTime(dateTo).Date;
                    audits.Where(audit=> audit.AdmAuditRecordEntered <= dateTo);
    //Search for string..
                   audits = audits.Where(audit => audit.Log.Contains(strSeachString));
    Above bold instruction is failing.

    Any help would be highly appreciated.

    Many thanks.

    M G

  2. Answer
    Thomas avatar
    590 posts

    Posted 15 Jul 2010 Link to this post

    Hi M G,

    I think the issue is that in the (potential) first invocation the audits variable is not updated with the new queryable instance that contains the date filter. You did that for the second .Where() though!

    Sincerely yours,
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top