Moves SqlNullableEquals to SqlExpressionExtensions
This commit is contained in:
@@ -788,19 +788,6 @@ namespace Umbraco.Core
|
||||
return BoolConvertCache[type] = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether two nullable values are equal, substituting a fallback value for nulls.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The nullable type.</typeparam>
|
||||
/// <param name="value">The value to compare.</param>
|
||||
/// <param name="other">The value to compare to.</param>
|
||||
/// <param name="fallbackValue">The value to use when any value is null.</param>
|
||||
/// <remarks>Do not use outside of Sql expressions.</remarks>
|
||||
// see usage in ExpressionVisitorBase
|
||||
public static bool SqlNullableEquals<T>(this T? value, T? other, T fallbackValue)
|
||||
where T : struct
|
||||
{
|
||||
return (value ?? fallbackValue).Equals(other ?? fallbackValue);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,21 @@ namespace Umbraco.Core.Persistence.Querying
|
||||
/// </summary>
|
||||
internal static class SqlExpressionExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates whether two nullable values are equal, substituting a fallback value for nulls.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The nullable type.</typeparam>
|
||||
/// <param name="value">The value to compare.</param>
|
||||
/// <param name="other">The value to compare to.</param>
|
||||
/// <param name="fallbackValue">The value to use when any value is null.</param>
|
||||
/// <remarks>Do not use outside of Sql expressions.</remarks>
|
||||
// see usage in ExpressionVisitorBase
|
||||
public static bool SqlNullableEquals<T>(this T? value, T? other, T fallbackValue)
|
||||
where T : struct
|
||||
{
|
||||
return (value ?? fallbackValue).Equals(other ?? fallbackValue);
|
||||
}
|
||||
|
||||
public static bool SqlIn<T>(this IEnumerable<T> collection, T item)
|
||||
{
|
||||
return collection.Contains(item);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using NPoco;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Persistence.Querying;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Persistence.Dtos;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
|
||||
Reference in New Issue
Block a user