forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTransparentCastFunction.cs
33 lines (31 loc) · 1.04 KB
/
TransparentCastFunction.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
using System;
using System.Collections;
using NHibernate.Engine;
using NHibernate.SqlCommand;
namespace NHibernate.Dialect.Function
{
/// <summary>
/// A HQL only cast for helping HQL knowing the type. Does not generates any actual cast in SQL code.
/// </summary>
[Serializable]
public class TransparentCastFunction : CastFunction
{
// Since v5.3
[Obsolete("This method has no usages and will be removed in a future version")]
protected override bool CastingIsRequired(string sqlType)
{
return false;
}
/// <summary>
/// Renders the SQL fragment representing the casted expression without actually casting it.
/// </summary>
/// <param name="expression">The cast argument.</param>
/// <param name="sqlType">The SQL type to cast to, ignored for rendering.</param>
/// <param name="factory">The session factory.</param>
/// <returns>A SQL fragment.</returns>
protected override SqlString Render(object expression, string sqlType, ISessionFactoryImplementor factory)
{
return new SqlString("(", expression, ")");
}
}
}