forked from samus/mongodb-csharp
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ProjectionExpression.cs
42 lines (36 loc) · 1.22 KB
/
ProjectionExpression.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
namespace MongoDB.Linq.Expressions
{
internal class ProjectionExpression : MongoExpression
{
private readonly SelectExpression _source;
private readonly Expression _projector;
private readonly LambdaExpression _aggregator;
public SelectExpression Source
{
get { return _source; }
}
public Expression Projector
{
get { return _projector; }
}
public LambdaExpression Aggregator
{
get { return _aggregator; }
}
public ProjectionExpression(SelectExpression source, Expression projector)
: this(source, projector, null)
{ }
public ProjectionExpression(SelectExpression source, Expression projector, LambdaExpression aggregator)
: base(MongoExpressionType.Projection, aggregator != null ? aggregator.Body.Type : typeof(IEnumerable<>).MakeGenericType(projector.Type))
{
_source = source;
_projector = projector;
_aggregator = aggregator;
}
}
}