forked from ThatRendle/Simple.Data
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJoinClause.cs
More file actions
54 lines (46 loc) · 1.54 KB
/
JoinClause.cs
File metadata and controls
54 lines (46 loc) · 1.54 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Simple.Data
{
/// <summary>
/// Represents an explicit join in a <see cref="SimpleQuery"/>.
/// There may be zero, one or multiple instances of this type in <see cref="SimpleQuery.Clauses"/>.
/// </summary>
public class JoinClause : SimpleQueryClauseBase
{
private readonly ObjectReference _table;
private readonly JoinType _joinType;
private readonly SimpleExpression _joinExpression;
public JoinClause(ObjectReference table, JoinType joinType) : this(table, joinType, null)
{
}
public JoinClause(ObjectReference table, SimpleExpression joinExpression) : this(table, JoinType.Inner, joinExpression)
{
}
public JoinClause(ObjectReference table, JoinType joinType, SimpleExpression joinExpression)
{
if (table == null) throw new ArgumentNullException("table");
_table = table;
_joinType = joinType;
_joinExpression = joinExpression;
}
public JoinType JoinType
{
get { return _joinType; }
}
public SimpleExpression JoinExpression
{
get { return _joinExpression; }
}
public ObjectReference Table
{
get { return _table; }
}
public string Name
{
get { return _table.GetAlias() ?? _table.GetName(); }
}
}
}