-
Notifications
You must be signed in to change notification settings - Fork 934
/
Copy pathAbstractCriterion.cs
94 lines (79 loc) · 2.59 KB
/
AbstractCriterion.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
using System;
using NHibernate.Engine;
using NHibernate.SqlCommand;
namespace NHibernate.Criterion
{
/// <summary>
/// Base class for <see cref="ICriterion"/> implementations.
/// </summary>
[Serializable]
public abstract class AbstractCriterion : ICriterion
{
/// <summary>
/// Gets a string representation of the <see cref="AbstractCriterion"/>.
/// </summary>
/// <returns>
/// A String that shows the contents of the <see cref="AbstractCriterion"/>.
/// </returns>
/// <remarks>
/// This is not a well formed Sql fragment. It is useful for logging what the <see cref="AbstractCriterion"/>
/// looks like.
/// </remarks>
public abstract override string ToString();
#region ICriterion Members
/// <summary>
/// Render a SqlString for the expression.
/// </summary>
/// <returns>A SqlString that contains a valid Sql fragment.</returns>
public abstract SqlString ToSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery);
/// <summary>
/// Return typed values for all parameters in the rendered SQL fragment
/// </summary>
/// <returns>An array of TypedValues for the Expression.</returns>
public abstract TypedValue[] GetTypedValues(ICriteria criteria, ICriteriaQuery criteriaQuery);
/// <summary>
/// Return all projections used in this criterion
/// </summary>
/// <returns>An array of IProjection used by the Expression.</returns>
public abstract IProjection[] GetProjections();
#endregion
#region Operator Overloading
public static AbstractCriterion operator &(AbstractCriterion lhs, AbstractCriterion rhs)
{
return new AndExpression(lhs, rhs);
}
public static AbstractCriterion operator |(AbstractCriterion lhs, AbstractCriterion rhs)
{
return new OrExpression(lhs, rhs);
}
public static AbstractCriterion operator &(AbstractCriterion lhs, AbstractEmptinessExpression rhs)
{
return new AndExpression(lhs, rhs);
}
public static AbstractCriterion operator |(AbstractCriterion lhs, AbstractEmptinessExpression rhs)
{
return new OrExpression(lhs, rhs);
}
public static AbstractCriterion operator !(AbstractCriterion crit)
{
return new NotExpression(crit);
}
/// <summary>
/// See here for details:
/// http://steve.emxsoftware.com/NET/Overloading+the++and++operators
/// </summary>
public static bool operator false(AbstractCriterion criteria)
{
return false;
}
/// <summary>
/// See here for details:
/// http://steve.emxsoftware.com/NET/Overloading+the++and++operators
/// </summary>
public static bool operator true(AbstractCriterion criteria)
{
return false;
}
#endregion
}
}