Skip to content

Commit 28dde43

Browse files
committed
Merge DecimalFloorGenerator & DecimalCeilingGenerator into MathGenerator
1 parent 16719fd commit 28dde43

File tree

3 files changed

+2
-34
lines changed

3 files changed

+2
-34
lines changed

src/NHibernate/Linq/Functions/DecimalGenerator.cs

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -104,38 +104,6 @@ public override HqlTreeNode BuildHql(MethodInfo method, Expression targetObject,
104104
}
105105
}
106106

107-
public class DecimalFloorGenerator : BaseHqlGeneratorForMethod
108-
{
109-
public DecimalFloorGenerator()
110-
{
111-
SupportedMethods = new[]
112-
{
113-
ReflectHelper.GetMethodDefinition(() => decimal.Floor(default(decimal)))
114-
};
115-
}
116-
117-
public override HqlTreeNode BuildHql(MethodInfo method, Expression targetObject, ReadOnlyCollection<Expression> arguments, HqlTreeBuilder treeBuilder, IHqlExpressionVisitor visitor)
118-
{
119-
return treeBuilder.MethodCall("floor", visitor.Visit(arguments[0]).AsExpression());
120-
}
121-
}
122-
123-
public class DecimalCeilingGenerator : BaseHqlGeneratorForMethod
124-
{
125-
public DecimalCeilingGenerator()
126-
{
127-
SupportedMethods = new[]
128-
{
129-
ReflectHelper.GetMethodDefinition(() => decimal.Ceiling(default(decimal)))
130-
};
131-
}
132-
133-
public override HqlTreeNode BuildHql(MethodInfo method, Expression targetObject, ReadOnlyCollection<Expression> arguments, HqlTreeBuilder treeBuilder, IHqlExpressionVisitor visitor)
134-
{
135-
return treeBuilder.MethodCall("ceiling", visitor.Visit(arguments[0]).AsExpression());
136-
}
137-
}
138-
139107
public class DecimalRoundGenerator : BaseHqlGeneratorForMethod
140108
{
141109
public DecimalRoundGenerator()

src/NHibernate/Linq/Functions/DefaultLinqToHqlGeneratorsRegistry.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ public DefaultLinqToHqlGeneratorsRegistry()
5858
this.Merge(new DecimalSubtractGenerator());
5959
this.Merge(new DecimalRemainderGenerator());
6060
this.Merge(new DecimalNegateGenerator());
61-
this.Merge(new DecimalFloorGenerator());
62-
this.Merge(new DecimalCeilingGenerator());
6361
this.Merge(new DecimalRoundGenerator());
6462
}
6563

src/NHibernate/Linq/Functions/MathGenerator.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,10 @@ public MathGenerator()
5151
ReflectHelper.GetMethodDefinition(() => Math.Round(default(double), default(int))),
5252
ReflectHelper.GetMethodDefinition(() => Math.Floor(default(decimal))),
5353
ReflectHelper.GetMethodDefinition(() => Math.Floor(default(double))),
54+
ReflectHelper.GetMethodDefinition(() => decimal.Floor(default(decimal))),
5455
ReflectHelper.GetMethodDefinition(() => Math.Ceiling(default(decimal))),
5556
ReflectHelper.GetMethodDefinition(() => Math.Ceiling(default(double))),
57+
ReflectHelper.GetMethodDefinition(() => decimal.Ceiling(default(decimal))),
5658
ReflectHelper.GetMethodDefinition(() => Math.Truncate(default(decimal))),
5759
ReflectHelper.GetMethodDefinition(() => Math.Truncate(default(double))),
5860

0 commit comments

Comments
 (0)