forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExpression.cs
76 lines (69 loc) · 2.03 KB
/
Expression.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
using System;
using NHibernate.SqlCommand;
using NHibernate.Type;
using NHibernate.Util;
namespace NHibernate.Criterion
{
/// <summary>
/// This class is semi-deprecated. Use <see cref="Restrictions"/>.
/// </summary>
/// <seealso cref="Restrictions"/>
public sealed class Expression : Restrictions
{
private Expression()
{
// can not be instantiated
}
/// <summary>
/// Apply a constraint expressed in SQL, with the given SQL parameters
/// </summary>
/// <param name="sql"></param>
/// <param name="values"></param>
/// <param name="types"></param>
/// <returns></returns>
public static AbstractCriterion Sql(SqlString sql, object[] values, IType[] types)
{
return new SQLCriterion(sql, values, types);
}
/// <summary>
/// Apply a constraint expressed in SQL, with the given SQL parameter
/// </summary>
/// <param name="sql"></param>
/// <param name="value"></param>
/// <param name="type"></param>
/// <returns></returns>
public static AbstractCriterion Sql(SqlString sql, object value, IType type)
{
return Sql(sql, new object[] { value }, new IType[] { type });
}
/// <summary>
/// Apply a constraint expressed in SQL, with the given SQL parameter
/// </summary>
public static AbstractCriterion Sql(string sql, object value, IType type)
{
return Sql(sql, new object[] { value }, new IType[] { type });
}
public static AbstractCriterion Sql(string sql, object[] values, IType[] types)
{
return new SQLCriterion(SqlString.Parse(sql), values, types);
}
/// <summary>
/// Apply a constraint expressed in SQL
/// </summary>
/// <param name="sql"></param>
/// <returns></returns>
public static AbstractCriterion Sql(SqlString sql)
{
return Sql(sql, Array.Empty<object>(), TypeHelper.EmptyTypeArray);
}
/// <summary>
/// Apply a constraint expressed in SQL
/// </summary>
/// <param name="sql"></param>
/// <returns></returns>
public static AbstractCriterion Sql(string sql)
{
return Sql(sql, Array.Empty<object>(), TypeHelper.EmptyTypeArray);
}
}
}