Skip to content

Commit 16de376

Browse files
committed
CSHARP-438. Added AsQueryable extension method for a typed MongoCollection to remove the redundant type specification requirement.
1 parent 3c814ca commit 16de376

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Driver/Linq/LinqExtensionMethods.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@ public static IQueryable<T> AsQueryable<T>(this MongoCollection collection)
3535
{
3636
var provider = new MongoQueryProvider(collection);
3737
return new MongoQueryable<T>(provider);
38+
}
39+
40+
/// <summary>
41+
/// Returns an instance of IQueryable{{T}} for a MongoCollection.
42+
/// </summary>
43+
/// <typeparam name="T">The type of the returned documents.</typeparam>
44+
/// <param name="collection">The name of the collection.</param>
45+
/// <returns>An instance of IQueryable{{T}} for a MongoCollection.</returns>
46+
public static IQueryable<T> AsQueryable<T>(this MongoCollection<T> collection)
47+
{
48+
var provider = new MongoQueryProvider(collection);
49+
return new MongoQueryable<T>(provider);
3850
}
3951
}
4052
}

0 commit comments

Comments
 (0)