Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-438

Add a new overload of AsQueryable<T> that deduces <T> from its MongoCollection<T> argument

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.4.1
    • Affects Version/s: 1.4
    • Component/s: None
    • Labels:
      None

      The AsQueryable<T> extension method is currently declared as:

      public static IQueryable<T> AsQueryable<T>(this MongoCollection collection)
      

      and this requires you to provide the <T> argument explicitly. This is not a bad thing in a schema free database where the same collection can contain different kinds of documents. In practice though, it is common for a collection to contain only a single kind of document, and adding the following new overload of AsQueryable<T> would allow <T> to be deduced from the collection:

      public static IQueryable<T> AsQueryable<T>(this MongoCollection<T> collection)
      

      I can't see any reason why the two overloads can't coexist.

            Assignee:
            craig.wilson@mongodb.com Craig Wilson
            Reporter:
            robert@mongodb.com Robert Stam
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: