LINQ Support for All() subquery

XMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      It would nice if the LINQ Provider would offer support for List<T>.TrueForAll(), Enumerable.All() or both so that something like the sample below would work out of the box:

      class Post
      {
      string Title;
      string Body;
      List<string> Tags;
      }

      This SearchByTag is supposed to search for all Posts containing ALL the tags.

      public List<Snip> SearchByTag(List<string> Tags, int PageSize, int
      StartPage, int PageCount)
      {
      using (var db = ServiceLocator.Get<IMongo>())

      { var posts = db.GetCollection<Post>(); List<Post> result; int skip = StartPage*PageSize; int take = PageCount*PageSize; if (Tags != null && Tags.Count > 0) result = posts.AsQueryable().Where(x => Tags.All(x.Tags.Contains)).OrderByDescending(x => x.LastAccess).Skip(skip).Take(take).ToList(); else result = posts.AsQueryable().OrderByDescending(x => x.LastAccess).Skip(skip).Take(take).ToList(); return result; }

            Assignee:
            Craig Wilson
            Reporter:
            Oliver Weichhold
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: