Skip to content

Commit c4d7540

Browse files
alex687craiggwilson
authored andcommitted
Adding AsQuerable Binder
1 parent bcd3d96 commit c4d7540

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq.Expressions;
4+
using MongoDB.Driver.Linq.Expressions;
5+
6+
namespace MongoDB.Driver.Linq.Processors.EmbeddedPipeline.MethodCallBinders
7+
{
8+
using System.Linq;
9+
using System.Reflection;
10+
11+
internal class AsQuerableBinder : IMethodCallBinder<EmbeddedPipelineBindingContext>
12+
{
13+
public static IEnumerable<MethodInfo> GetSupportedMethods()
14+
{
15+
yield return MethodHelper.GetMethodDefinition(() => Queryable.AsQueryable(null));
16+
yield return MethodHelper.GetMethodDefinition(() => Queryable.AsQueryable<object>(null));
17+
}
18+
19+
public Expression Bind(
20+
PipelineExpression pipeline,
21+
EmbeddedPipelineBindingContext bindingContext,
22+
MethodCallExpression node,
23+
IEnumerable<Expression> arguments)
24+
{
25+
return pipeline;
26+
}
27+
}
28+
}

src/MongoDB.Driver/MongoDB.Driver.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@
158158
<Compile Include="Linq\Processors\EmbeddedPipeline\EmbeddedPipelineBinder.cs" />
159159
<Compile Include="Linq\Processors\EmbeddedPipeline\EmbeddedPipelineBindingContext.cs" />
160160
<Compile Include="Linq\Processors\EmbeddedPipeline\MethodCallBinders\AllBinder.cs" />
161+
<Compile Include="Linq\Processors\EmbeddedPipeline\MethodCallBinders\AsQuerableBinder.cs" />
161162
<Compile Include="Linq\Processors\EmbeddedPipeline\MethodCallBinders\ConcatBinder.cs" />
162163
<Compile Include="Linq\Processors\EmbeddedPipeline\MethodCallBinders\OfTypeBinder.cs" />
163164
<Compile Include="Linq\Processors\EmbeddedPipeline\MethodCallBinders\SkipBinder.cs" />

0 commit comments

Comments
 (0)