Skip to content

Commit

Permalink
Renamed variable/property
Browse files Browse the repository at this point in the history
  • Loading branch information
PawelGerr committed Feb 4, 2024
1 parent ac4a3b2 commit c7a7e07
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ public abstract partial class WindowFunction
/// <summary>
/// Indication whether to use '*' when no arguments are provided.
/// </summary>
public bool UseStarWhenNoArguments { get; }
public bool UseAsteriskWhenNoArguments { get; }

/// <summary>
/// Initializes a new instance of <see cref="WindowFunction"/>.
/// </summary>
/// <param name="name">The name of the window function.</param>
/// <param name="returnType">Return type of the function.</param>
/// <param name="useStarWhenNoArguments">Indication whether to use '*' when no arguments are provided.</param>
protected WindowFunction(string name, Type returnType, bool useStarWhenNoArguments)
/// <param name="useAsteriskWhenNoArguments">Indication whether to use '*' when no arguments are provided.</param>
protected WindowFunction(string name, Type returnType, bool useAsteriskWhenNoArguments)
{
Name = EnsureValidName(name);
ReturnType = returnType ?? throw new ArgumentNullException(nameof(returnType));
UseStarWhenNoArguments = useStarWhenNoArguments;
UseAsteriskWhenNoArguments = useAsteriskWhenNoArguments;
}

private static string EnsureValidName(string name)
Expand All @@ -67,12 +67,12 @@ private static string EnsureValidName(string name)
/// </summary>
/// <param name="name">The name of the function.</param>
/// <param name="returnType">The return type of the function.</param>
/// <param name="useStarWhenNoArguments">Indication whether to use '*' when no arguments are provided.</param>
public void Deconstruct(out string name, out Type returnType, out bool useStarWhenNoArguments)
/// <param name="useAsteriskWhenNoArguments">Indication whether to use '*' when no arguments are provided.</param>
public void Deconstruct(out string name, out Type returnType, out bool useAsteriskWhenNoArguments)
{
name = Name;
returnType = ReturnType;
useStarWhenNoArguments = UseStarWhenNoArguments;
useAsteriskWhenNoArguments = UseAsteriskWhenNoArguments;
}
}

Expand All @@ -85,11 +85,11 @@ public sealed class WindowFunction<TResult> : WindowFunction, IEquatable<WindowF
/// Initializes a new instance of <see cref="WindowFunction{TResult}"/>.
/// </summary>
/// <param name="name">The name of the window function</param>
/// <param name="useStarWhenNoArguments">Indication whether to use '*' when no arguments are provided.</param>
/// <param name="useAsteriskWhenNoArguments">Indication whether to use '*' when no arguments are provided.</param>
public WindowFunction(
string name,
bool useStarWhenNoArguments = false)
: base(name, typeof(TResult), useStarWhenNoArguments)
bool useAsteriskWhenNoArguments = false)
: base(name, typeof(TResult), useAsteriskWhenNoArguments)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ internal SqlServerDbFunctionsTranslator(

private SqlExpression CreateWindowFunction(IReadOnlyList<SqlExpression> arguments)
{
var (functionName, returnType, useStarWhenNoArguments) = (WindowFunction?)((SqlConstantExpression)arguments[1]).Value
var (functionName, returnType, useAsteriskWhenNoArguments) = (WindowFunction?)((SqlConstantExpression)arguments[1]).Value
?? throw new ArgumentException("Window function must not be null");

var orderByExpression = arguments[^1] as WindowFunctionOrderingsExpression;
Expand Down Expand Up @@ -101,7 +101,7 @@ private SqlExpression CreateWindowFunction(IReadOnlyList<SqlExpression> argument
var partitionBy = partitionByExpression?.PartitionBy.Select(e => _sqlExpressionFactory.ApplyDefaultTypeMapping(e)).ToList();

return new WindowFunctionExpression(functionName,
useStarWhenNoArguments,
useAsteriskWhenNoArguments,
returnType,
_typeMappingSource.FindMapping(returnType, _model),
functionArgs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ public class WindowFunctionExpression : SqlExpression
/// Creates a new instance of the <see cref="WindowFunctionExpression" /> class.
/// </summary>
/// <param name="name">Function name.</param>
/// <param name="useStarWhenNoArguments">Indication whether to use '*' when no arguments are provided.</param>
/// <param name="useAsteriskWhenNoArguments">Indication whether to use '*' when no arguments are provided.</param>
/// <param name="type">Return type.</param>
/// <param name="arguments">Arguments.</param>
/// <param name="typeMapping">Type mapping.</param>
/// <param name="partitions">A list expressions to partition by.</param>
/// <param name="orderings">A list of ordering expressions to order by.</param>
public WindowFunctionExpression(
string name,
bool useStarWhenNoArguments,
bool useAsteriskWhenNoArguments,
Type type,
RelationalTypeMapping? typeMapping,
IReadOnlyList<SqlExpression> arguments,
Expand All @@ -32,7 +32,7 @@ public WindowFunctionExpression(
: base(type, typeMapping)
{
Name = name;
UseStarWhenNoArguments = useStarWhenNoArguments;
UseAsteriskWhenNoArguments = useAsteriskWhenNoArguments;
Arguments = arguments;
Partitions = partitions ?? Array.Empty<SqlExpression>();
Orderings = orderings ?? Array.Empty<OrderingExpression>();
Expand All @@ -46,7 +46,7 @@ public WindowFunctionExpression(
/// <summary>
/// Indication whether to use '*' when no arguments are provided.
/// </summary>
public bool UseStarWhenNoArguments { get; }
public bool UseAsteriskWhenNoArguments { get; }

/// <summary>
/// Function arguments.
Expand All @@ -71,7 +71,7 @@ protected override Expression VisitChildren(ExpressionVisitor visitor)
var orderings = visitor.VisitExpressions(Orderings);

return !ReferenceEquals(arguments, Arguments) || !ReferenceEquals(partitions, Partitions) || !ReferenceEquals(orderings, Orderings)
? new WindowFunctionExpression(Name, UseStarWhenNoArguments, Type, TypeMapping, arguments, partitions, orderings)
? new WindowFunctionExpression(Name, UseAsteriskWhenNoArguments, Type, TypeMapping, arguments, partitions, orderings)
: this;
}

Expand All @@ -84,7 +84,7 @@ protected override void Print(ExpressionPrinter expressionPrinter)
{
expressionPrinter.VisitCollection(Arguments);
}
else if (UseStarWhenNoArguments)
else if (UseAsteriskWhenNoArguments)
{
expressionPrinter.Append(" * ");
}
Expand Down Expand Up @@ -118,7 +118,7 @@ private bool Equals(WindowFunctionExpression windowFunctionExpression)
{
return base.Equals(windowFunctionExpression)
&& Name.Equals(windowFunctionExpression.Name)
&& UseStarWhenNoArguments.Equals(windowFunctionExpression.UseStarWhenNoArguments)
&& UseAsteriskWhenNoArguments.Equals(windowFunctionExpression.UseAsteriskWhenNoArguments)
&& (Arguments == null ? windowFunctionExpression.Arguments == null : Arguments.SequenceEqual(windowFunctionExpression.Arguments))
&& (Partitions == null ? windowFunctionExpression.Partitions == null : Partitions.SequenceEqual(windowFunctionExpression.Partitions))
&& (Orderings == null ? windowFunctionExpression.Orderings == null : Orderings.SequenceEqual(windowFunctionExpression.Orderings));
Expand All @@ -130,7 +130,7 @@ public override int GetHashCode()
var hash = new HashCode();
hash.Add(base.GetHashCode());
hash.Add(Name);
hash.Add(UseStarWhenNoArguments);
hash.Add(UseAsteriskWhenNoArguments);

foreach (var argument in Arguments)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private Expression VisitWindowFunction(WindowFunctionExpression windowFunctionEx
Visit(argument);
}

if (windowFunctionExpression.Arguments.Count == 0 && windowFunctionExpression.UseStarWhenNoArguments)
if (windowFunctionExpression.Arguments.Count == 0 && windowFunctionExpression.UseAsteriskWhenNoArguments)
Sql.Append("*");

Sql.Append(") OVER (");
Expand Down

0 comments on commit c7a7e07

Please sign in to comment.