From 748cea8e768b129f0488559d7e1e6d25ab3b2741 Mon Sep 17 00:00:00 2001 From: Austin Drenski Date: Sun, 15 Jul 2018 16:30:47 -0400 Subject: [PATCH] Split off unrelated changes and rollback - ClientEvaluationNotSupportedException.cs - NpgsqlRangeExtensions.cs --- .../Extensions/NpgsqlNetworkExtensions.cs | 318 +++++++++--------- .../Extensions/NpgsqlRangeExtensions.cs | 81 ++--- .../ClientEvaluationNotSupportedException.cs | 48 --- 3 files changed, 189 insertions(+), 258 deletions(-) delete mode 100644 src/EFCore.PG/Utilities/ClientEvaluationNotSupportedException.cs diff --git a/src/EFCore.PG/Extensions/NpgsqlNetworkExtensions.cs b/src/EFCore.PG/Extensions/NpgsqlNetworkExtensions.cs index 24d3be8a26..c4b9635d7c 100644 --- a/src/EFCore.PG/Extensions/NpgsqlNetworkExtensions.cs +++ b/src/EFCore.PG/Extensions/NpgsqlNetworkExtensions.cs @@ -23,10 +23,11 @@ #endregion +using System; using System.Net; using System.Net.NetworkInformation; +using System.Runtime.CompilerServices; using JetBrains.Annotations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Utilities; // ReSharper disable once CheckNamespace namespace Microsoft.EntityFrameworkCore @@ -50,11 +51,11 @@ public static class NpgsqlNetworkExtensions /// /// True if the is less than the other ; otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool LessThan([CanBeNull] this DbFunctions _, IPAddress inet, IPAddress other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether an (IPAddress Address, int Subnet) is less than another (IPAddress Address, int Subnet). @@ -65,11 +66,11 @@ public static bool LessThan([CanBeNull] this DbFunctions _, IPAddress inet, IPAd /// /// True if the (IPAddress Address, int Subnet) is less than the other (IPAddress Address, int Subnet); otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool LessThan([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr, (IPAddress Address, int Subnet) other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether an is less than another . @@ -80,11 +81,11 @@ public static bool LessThan([CanBeNull] this DbFunctions _, (IPAddress Address, /// /// True if the is less than the other ; otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool LessThan([CanBeNull] this DbFunctions _, PhysicalAddress macaddr, PhysicalAddress other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether an is less than or equal to another . @@ -95,11 +96,11 @@ public static bool LessThan([CanBeNull] this DbFunctions _, PhysicalAddress maca /// /// True if the is less than or equal to the other ; otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool LessThanOrEqual([CanBeNull] this DbFunctions _, IPAddress inet, IPAddress other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether an (IPAddress Address, int Subnet) is less than or equal to another (IPAddress Address, int Subnet). @@ -110,11 +111,11 @@ public static bool LessThanOrEqual([CanBeNull] this DbFunctions _, IPAddress ine /// /// True if the (IPAddress Address, int Subnet) is less than or equal to the other (IPAddress Address, int Subnet); otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool LessThanOrEqual([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr, (IPAddress Address, int Subnet) other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether an is less than or equal to another . @@ -125,11 +126,11 @@ public static bool LessThanOrEqual([CanBeNull] this DbFunctions _, (IPAddress Ad /// /// True if the is less than or equal to the other ; otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool LessThanOrEqual([CanBeNull] this DbFunctions _, PhysicalAddress macaddr, PhysicalAddress other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether an is equal to another . @@ -140,11 +141,11 @@ public static bool LessThanOrEqual([CanBeNull] this DbFunctions _, PhysicalAddre /// /// True if the is equal to the other ; otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool Equal([CanBeNull] this DbFunctions _, IPAddress inet, IPAddress other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether an (IPAddress Address, int Subnet) is equal to another (IPAddress Address, int Subnet). @@ -155,11 +156,11 @@ public static bool Equal([CanBeNull] this DbFunctions _, IPAddress inet, IPAddre /// /// True if the (IPAddress Address, int Subnet) is equal to the other (IPAddress Address, int Subnet); otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool Equal([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr, (IPAddress Address, int Subnet) other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether an is equal to another . @@ -170,11 +171,11 @@ public static bool Equal([CanBeNull] this DbFunctions _, (IPAddress Address, int /// /// True if the is equal to the other ; otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool Equal([CanBeNull] this DbFunctions _, PhysicalAddress macaddr, PhysicalAddress other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether an is greater than or equal to another . @@ -185,11 +186,11 @@ public static bool Equal([CanBeNull] this DbFunctions _, PhysicalAddress macaddr /// /// True if the is greater than or equal to the other ; otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool GreaterThanOrEqual([CanBeNull] this DbFunctions _, IPAddress inet, IPAddress other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether an (IPAddress Address, int Subnet) is greater than or equal to another (IPAddress Address, int Subnet). @@ -200,11 +201,11 @@ public static bool GreaterThanOrEqual([CanBeNull] this DbFunctions _, IPAddress /// /// True if the (IPAddress Address, int Subnet) is greater than or equal to the other (IPAddress Address, int Subnet); otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool GreaterThanOrEqual([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr, (IPAddress Address, int Subnet) other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether an is greater than or equal to another . @@ -215,11 +216,11 @@ public static bool GreaterThanOrEqual([CanBeNull] this DbFunctions _, (IPAddress /// /// True if the is greater than or equal to the other ; otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool GreaterThanOrEqual([CanBeNull] this DbFunctions _, PhysicalAddress macaddr, PhysicalAddress other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether an is greater than another . @@ -230,11 +231,11 @@ public static bool GreaterThanOrEqual([CanBeNull] this DbFunctions _, PhysicalAd /// /// True if the is greater than the other ; otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool GreaterThan([CanBeNull] this DbFunctions _, IPAddress inet, IPAddress other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether an (IPAddress Address, int Subnet) is greater than another (IPAddress Address, int Subnet). @@ -245,11 +246,11 @@ public static bool GreaterThan([CanBeNull] this DbFunctions _, IPAddress inet, I /// /// True if the (IPAddress Address, int Subnet) is greater than the other (IPAddress Address, int Subnet); otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool GreaterThan([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr, (IPAddress Address, int Subnet) other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether an is greater than another . @@ -260,11 +261,11 @@ public static bool GreaterThan([CanBeNull] this DbFunctions _, (IPAddress Addres /// /// True if the is greater than the other ; otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool GreaterThan([CanBeNull] this DbFunctions _, PhysicalAddress macaddr, PhysicalAddress other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether an is not equal to another . @@ -275,11 +276,11 @@ public static bool GreaterThan([CanBeNull] this DbFunctions _, PhysicalAddress m /// /// True if the is not equal to the other ; otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool NotEqual([CanBeNull] this DbFunctions _, IPAddress inet, IPAddress other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether an (IPAddress Address, int Subnet) is not equal to another (IPAddress Address, int Subnet). @@ -290,11 +291,11 @@ public static bool NotEqual([CanBeNull] this DbFunctions _, IPAddress inet, IPAd /// /// True if the IPAddress Address, int Subnet) is not equal to the other (IPAddress Address, int Subnet); otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool NotEqual([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr, (IPAddress Address, int Subnet) other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether an is not equal to another . @@ -305,11 +306,11 @@ public static bool NotEqual([CanBeNull] this DbFunctions _, (IPAddress Address, /// /// True if the is not equal to the other ; otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool NotEqual([CanBeNull] this DbFunctions _, PhysicalAddress macaddr, PhysicalAddress other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); #endregion @@ -324,11 +325,11 @@ public static bool NotEqual([CanBeNull] this DbFunctions _, PhysicalAddress maca /// /// True if the is contained within the other ; otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool ContainedBy([CanBeNull] this DbFunctions _, IPAddress inet, IPAddress other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether an is contained within a network. @@ -339,11 +340,11 @@ public static bool ContainedBy([CanBeNull] this DbFunctions _, IPAddress inet, I /// /// True if the is contained within the network; otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool ContainedBy([CanBeNull] this DbFunctions _, IPAddress inet, (IPAddress Address, int Subnet) other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether an (IPAddress Address, int Subnet) is contained within another (IPAddress Address, int Subnet). @@ -354,11 +355,11 @@ public static bool ContainedBy([CanBeNull] this DbFunctions _, IPAddress inet, ( /// /// True if the (IPAddress Address, int Subnet) is contained within the other (IPAddress Address, int Subnet); otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool ContainedBy([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr, (IPAddress Address, int Subnet) other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether an is contained within or equal to another . @@ -369,11 +370,11 @@ public static bool ContainedBy([CanBeNull] this DbFunctions _, (IPAddress Addres /// /// True if the is contained within or equal to the other ; otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool ContainedByOrEqual([CanBeNull] this DbFunctions _, IPAddress inet, IPAddress other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether an is contained within or equal to a network. @@ -384,11 +385,11 @@ public static bool ContainedByOrEqual([CanBeNull] this DbFunctions _, IPAddress /// /// True if the is contained within or equal to the network; otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool ContainedByOrEqual([CanBeNull] this DbFunctions _, IPAddress inet, (IPAddress Address, int Subnet) other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether an (IPAddress Address, int Subnet) is contained within or equal to another (IPAddress Address, int Subnet). @@ -399,11 +400,11 @@ public static bool ContainedByOrEqual([CanBeNull] this DbFunctions _, IPAddress /// /// True if the (IPAddress Address, int Subnet) is contained within or equal to the other (IPAddress Address, int Subnet); otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool ContainedByOrEqual([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr, (IPAddress Address, int Subnet) other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether an contains another . @@ -414,11 +415,11 @@ public static bool ContainedByOrEqual([CanBeNull] this DbFunctions _, (IPAddress /// /// True if the contains the other ; otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool Contains([CanBeNull] this DbFunctions _, IPAddress inet, IPAddress other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether a network contains another . @@ -429,11 +430,11 @@ public static bool Contains([CanBeNull] this DbFunctions _, IPAddress inet, IPAd /// /// True if the network contains the other ; otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool Contains([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr, IPAddress other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether an (IPAddress Address, int Subnet) contains another (IPAddress Address, int Subnet). @@ -444,11 +445,11 @@ public static bool Contains([CanBeNull] this DbFunctions _, (IPAddress Address, /// /// True if the (IPAddress Address, int Subnet) contains the other (IPAddress Address, int Subnet); otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool Contains([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr, (IPAddress Address, int Subnet) other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether an contains or is equal to another . @@ -459,11 +460,11 @@ public static bool Contains([CanBeNull] this DbFunctions _, (IPAddress Address, /// /// True if the contains or is equal to the other ; otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool ContainsOrEqual([CanBeNull] this DbFunctions _, IPAddress inet, IPAddress other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether a network contains or is equal to another . @@ -474,11 +475,11 @@ public static bool ContainsOrEqual([CanBeNull] this DbFunctions _, IPAddress ine /// /// True if the network contains or is equal to the other ; otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool ContainsOrEqual([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr, IPAddress other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether an (IPAddress Address, int Subnet) contains or is equal to another (IPAddress Address, int Subnet). @@ -489,11 +490,11 @@ public static bool ContainsOrEqual([CanBeNull] this DbFunctions _, (IPAddress Ad /// /// True if the (IPAddress Address, int Subnet) contains or is equal to the other (IPAddress Address, int Subnet); otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool ContainsOrEqual([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr, (IPAddress Address, int Subnet) other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether an contains or is contained by another . @@ -504,11 +505,11 @@ public static bool ContainsOrEqual([CanBeNull] this DbFunctions _, (IPAddress Ad /// /// True if the contains or is contained by the other ; otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool ContainsOrContainedBy([CanBeNull] this DbFunctions _, IPAddress inet, IPAddress other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether a network contains or is contained by an . @@ -519,11 +520,11 @@ public static bool ContainsOrContainedBy([CanBeNull] this DbFunctions _, IPAddre /// /// True if the network contains or is contained by the ; otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool ContainsOrContainedBy([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr, IPAddress other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether an contains or is contained by a network. @@ -534,11 +535,11 @@ public static bool ContainsOrContainedBy([CanBeNull] this DbFunctions _, (IPAddr /// /// True if the contains or is contained by the network; otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool ContainsOrContainedBy([CanBeNull] this DbFunctions _, IPAddress inet, (IPAddress Address, int Subnet) other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Determines whether an (IPAddress Address, int Subnet) contains or is contained by another (IPAddress Address, int Subnet). @@ -549,11 +550,11 @@ public static bool ContainsOrContainedBy([CanBeNull] this DbFunctions _, IPAddre /// /// True if the (IPAddress Address, int Subnet) contains or is contained by the other (IPAddress Address, int Subnet); otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool ContainsOrContainedBy([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr, (IPAddress Address, int Subnet) other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); #endregion @@ -567,11 +568,11 @@ public static bool ContainsOrContainedBy([CanBeNull] this DbFunctions _, (IPAddr /// /// The result of the bitwise NOT operation. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static IPAddress BitwiseNot([CanBeNull] this DbFunctions _, IPAddress inet) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Computes the bitwise NOT operation on an (IPAddress Address, int Subnet). @@ -581,11 +582,11 @@ public static IPAddress BitwiseNot([CanBeNull] this DbFunctions _, IPAddress ine /// /// The result of the bitwise NOT operation. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static (IPAddress Address, int Subnet) BitwiseNot([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Computes the bitwise NOT operation on an . @@ -595,11 +596,11 @@ public static (IPAddress Address, int Subnet) BitwiseNot([CanBeNull] this DbFunc /// /// The result of the bitwise NOT operation. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static PhysicalAddress BitwiseNot([CanBeNull] this DbFunctions _, PhysicalAddress macaddr) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Computes the bitwise AND of two instances. @@ -610,11 +611,11 @@ public static PhysicalAddress BitwiseNot([CanBeNull] this DbFunctions _, Physica /// /// The result of the bitwise AND operation. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static IPAddress BitwiseAnd([CanBeNull] this DbFunctions _, IPAddress inet, IPAddress other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Computes the bitwise AND of two (IPAddress Address, int Subnet) instances. @@ -625,11 +626,11 @@ public static IPAddress BitwiseAnd([CanBeNull] this DbFunctions _, IPAddress ine /// /// The result of the bitwise AND operation. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static (IPAddress Address, int Subnet) BitwiseAnd([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr, (IPAddress Address, int Subnet) other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Computes the bitwise AND of two instances. @@ -640,11 +641,11 @@ public static (IPAddress Address, int Subnet) BitwiseAnd([CanBeNull] this DbFunc /// /// The result of the bitwise AND operation. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static PhysicalAddress BitwiseAnd([CanBeNull] this DbFunctions _, PhysicalAddress macaddr, PhysicalAddress other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Computes the bitwise OR of two instances. @@ -655,11 +656,11 @@ public static PhysicalAddress BitwiseAnd([CanBeNull] this DbFunctions _, Physica /// /// The result of the bitwise OR operation. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static IPAddress BitwiseOr([CanBeNull] this DbFunctions _, IPAddress inet, IPAddress other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Computes the bitwise OR of two (IPAddress Address, int Subnet) instances. @@ -670,11 +671,11 @@ public static IPAddress BitwiseOr([CanBeNull] this DbFunctions _, IPAddress inet /// /// The result of the bitwise OR operation. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static (IPAddress Address, int Subnet) BitwiseOr([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr, (IPAddress Address, int Subnet) other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Computes the bitwise OR of two instances. @@ -685,11 +686,11 @@ public static (IPAddress Address, int Subnet) BitwiseOr([CanBeNull] this DbFunct /// /// The result of the bitwise OR operation. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static PhysicalAddress BitwiseOr([CanBeNull] this DbFunctions _, PhysicalAddress macaddr, PhysicalAddress other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); #endregion @@ -704,11 +705,11 @@ public static PhysicalAddress BitwiseOr([CanBeNull] this DbFunctions _, Physical /// /// The augmented by the . /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static IPAddress Add([CanBeNull] this DbFunctions _, IPAddress inet, int value) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Adds the to the (IPAddress Address, int Subnet). @@ -719,11 +720,11 @@ public static IPAddress Add([CanBeNull] this DbFunctions _, IPAddress inet, int /// /// The (IPAddress Address, int Subnet) augmented by the . /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static (IPAddress Address, int Subnet) Add([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr, int value) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Subtracts the from the . @@ -734,11 +735,11 @@ public static (IPAddress Address, int Subnet) Add([CanBeNull] this DbFunctions _ /// /// The augmented by the . /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static IPAddress Subtract([CanBeNull] this DbFunctions _, IPAddress inet, int value) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Subtracts the from the (IPAddress Address, int Subnet). @@ -749,11 +750,11 @@ public static IPAddress Subtract([CanBeNull] this DbFunctions _, IPAddress inet, /// /// The (IPAddress Address, int Subnet) augmented by the . /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static (IPAddress Address, int Subnet) Subtract([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr, int value) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Subtracts one from another . @@ -764,11 +765,11 @@ public static (IPAddress Address, int Subnet) Subtract([CanBeNull] this DbFuncti /// /// The augmented by the . /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static IPAddress Subtract([CanBeNull] this DbFunctions _, IPAddress inet, IPAddress other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Subtracts one (IPAddress Address, int Subnet) from another (IPAddress Address, int Subnet). @@ -779,11 +780,11 @@ public static IPAddress Subtract([CanBeNull] this DbFunctions _, IPAddress inet, /// /// The (IPAddress Address, int Subnet) augmented by the . /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static (IPAddress Address, int Subnet) Subtract([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr, (IPAddress Address, int Subnet) other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); #endregion @@ -797,11 +798,11 @@ public static (IPAddress Address, int Subnet) Subtract([CanBeNull] this DbFuncti /// /// The abbreviated display format as text. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static string Abbreviate([CanBeNull] this DbFunctions _, IPAddress inet) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Returns the abbreviated display format as text. @@ -811,11 +812,11 @@ public static string Abbreviate([CanBeNull] this DbFunctions _, IPAddress inet) /// /// The abbreviated display format as text. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static string Abbreviate([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Returns the broadcast address for a network. @@ -825,11 +826,11 @@ public static string Abbreviate([CanBeNull] this DbFunctions _, (IPAddress Addre /// /// The broadcast address for a network. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static IPAddress Broadcast([CanBeNull] this DbFunctions _, IPAddress inet) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Returns the broadcast address for a network. @@ -839,11 +840,11 @@ public static IPAddress Broadcast([CanBeNull] this DbFunctions _, IPAddress inet /// /// The broadcast address for a network. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static IPAddress Broadcast([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Extracts the family of an address; 4 for IPv4, 6 for IPv6. @@ -853,11 +854,11 @@ public static IPAddress Broadcast([CanBeNull] this DbFunctions _, (IPAddress Add /// /// The family of an address; 4 for IPv4, 6 for IPv6. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static int Family([CanBeNull] this DbFunctions _, IPAddress inet) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Extracts the family of an address; 4 for IPv4, 6 for IPv6. @@ -867,11 +868,11 @@ public static int Family([CanBeNull] this DbFunctions _, IPAddress inet) /// /// The family of an address; 4 for IPv4, 6 for IPv6. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static int Family([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Extracts the host (i.e. the IP address) as text. @@ -881,11 +882,11 @@ public static int Family([CanBeNull] this DbFunctions _, (IPAddress Address, int /// /// The host (i.e. the IP address) as text. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static string Host([CanBeNull] this DbFunctions _, IPAddress inet) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Extracts the host (i.e. the IP address) as text. @@ -895,11 +896,11 @@ public static string Host([CanBeNull] this DbFunctions _, IPAddress inet) /// /// The host (i.e. the IP address) as text. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static string Host([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Constructs the host mask for the network. @@ -909,11 +910,11 @@ public static string Host([CanBeNull] this DbFunctions _, (IPAddress Address, in /// /// The constructed host mask. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static IPAddress HostMask([CanBeNull] this DbFunctions _, IPAddress inet) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Constructs the host mask for the network. @@ -923,11 +924,11 @@ public static IPAddress HostMask([CanBeNull] this DbFunctions _, IPAddress inet) /// /// The constructed host mask. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static IPAddress HostMask([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Extracts the length of the subnet mask. @@ -937,11 +938,11 @@ public static IPAddress HostMask([CanBeNull] this DbFunctions _, (IPAddress Addr /// /// The length of the subnet mask. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static int MaskLength([CanBeNull] this DbFunctions _, IPAddress inet) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Extracts the length of the subnet mask. @@ -951,11 +952,11 @@ public static int MaskLength([CanBeNull] this DbFunctions _, IPAddress inet) /// /// The length of the subnet mask. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static int MaskLength([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Constructs the subnet mask for the network. @@ -965,11 +966,11 @@ public static int MaskLength([CanBeNull] this DbFunctions _, (IPAddress Address, /// /// The subnet mask for the network. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static IPAddress Netmask([CanBeNull] this DbFunctions _, IPAddress inet) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Constructs the subnet mask for the network. @@ -979,11 +980,11 @@ public static IPAddress Netmask([CanBeNull] this DbFunctions _, IPAddress inet) /// /// The subnet mask for the network. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static IPAddress Netmask([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Extracts the network part of the address. @@ -993,11 +994,11 @@ public static IPAddress Netmask([CanBeNull] this DbFunctions _, (IPAddress Addre /// /// The network part of the address. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static (IPAddress Address, int Subnet) Network([CanBeNull] this DbFunctions _, IPAddress inet) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Extracts the network part of the address. @@ -1007,11 +1008,11 @@ public static (IPAddress Address, int Subnet) Network([CanBeNull] this DbFunctio /// /// The network part of the address. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static (IPAddress Address, int Subnet) Network([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Sets the length of the subnet mask. @@ -1022,11 +1023,11 @@ public static (IPAddress Address, int Subnet) Network([CanBeNull] this DbFunctio /// /// The network with a subnet mask of the specified length. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static IPAddress SetMaskLength([CanBeNull] this DbFunctions _, IPAddress inet, int length) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Sets the length of the subnet mask. @@ -1037,11 +1038,11 @@ public static IPAddress SetMaskLength([CanBeNull] this DbFunctions _, IPAddress /// /// The network with a subnet mask of the specified length. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static (IPAddress Address, int Subnet) SetMaskLength([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr, int length) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Extracts the IP address and subnet mask as text. @@ -1051,11 +1052,11 @@ public static (IPAddress Address, int Subnet) SetMaskLength([CanBeNull] this DbF /// /// The IP address and subnet mask as text. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static string Text([CanBeNull] this DbFunctions _, IPAddress inet) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Extracts the IP address and subnet mask as text. @@ -1065,11 +1066,11 @@ public static string Text([CanBeNull] this DbFunctions _, IPAddress inet) /// /// The IP address and subnet mask as text. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static string Text([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Tests if the addresses are in the same family. @@ -1080,11 +1081,11 @@ public static string Text([CanBeNull] this DbFunctions _, (IPAddress Address, in /// /// True if the addresses are in the same family; otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool SameFamily([CanBeNull] this DbFunctions _, IPAddress inet, IPAddress other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Tests if the addresses are in the same family. @@ -1095,11 +1096,11 @@ public static bool SameFamily([CanBeNull] this DbFunctions _, IPAddress inet, IP /// /// True if the addresses are in the same family; otherwise, false. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static bool SameFamily([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr, (IPAddress Address, int Subnet) other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Constructs the smallest network which includes both of the given networks. @@ -1110,11 +1111,11 @@ public static bool SameFamily([CanBeNull] this DbFunctions _, (IPAddress Address /// /// The smallest network which includes both of the given networks. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static (IPAddress Address, int Subnet) Merge([CanBeNull] this DbFunctions _, IPAddress inet, IPAddress other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Constructs the smallest network which includes both of the given networks. @@ -1125,11 +1126,11 @@ public static (IPAddress Address, int Subnet) Merge([CanBeNull] this DbFunctions /// /// The smallest network which includes both of the given networks. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static (IPAddress Address, int Subnet) Merge([CanBeNull] this DbFunctions _, (IPAddress Address, int Subnet) cidr, (IPAddress Address, int Subnet) other) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Sets the last 3 bytes of the MAC address to zero. For macaddr8, the last 5 bytes are set to zero. @@ -1139,11 +1140,11 @@ public static (IPAddress Address, int Subnet) Merge([CanBeNull] this DbFunctions /// /// The MAC address with the last 3 bytes set to zero. For macaddr8, the last 5 bytes are set to zero. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static PhysicalAddress Truncate([CanBeNull] this DbFunctions _, PhysicalAddress macAddress) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); /// /// Sets the 7th bit to one, also known as modified EUI-64, for inclusion in an IPv6 address. @@ -1153,11 +1154,26 @@ public static PhysicalAddress Truncate([CanBeNull] this DbFunctions _, PhysicalA /// /// The MAC address with the 7th bit set to one. /// - /// + /// /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. /// public static PhysicalAddress Set7BitMac8([CanBeNull] this DbFunctions _, PhysicalAddress macAddress) - => throw new ClientEvaluationNotSupportedException(); + => throw ClientEvaluationNotSupportedException(); + + #endregion + + #region Utilities + + /// + /// Helper method to throw a with the name of the throwing method. + /// + /// The method that throws the exception. + /// + /// A . + /// + [NotNull] + static NotSupportedException ClientEvaluationNotSupportedException([CallerMemberName] string method = default) + => new NotSupportedException($"{method} is only intended for use via SQL translation as part of an EF Core LINQ query."); #endregion } diff --git a/src/EFCore.PG/Extensions/NpgsqlRangeExtensions.cs b/src/EFCore.PG/Extensions/NpgsqlRangeExtensions.cs index 132f5eaf0b..8f3821c903 100644 --- a/src/EFCore.PG/Extensions/NpgsqlRangeExtensions.cs +++ b/src/EFCore.PG/Extensions/NpgsqlRangeExtensions.cs @@ -23,8 +23,7 @@ #endregion -using JetBrains.Annotations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Utilities; +using System; using NpgsqlTypes; // ReSharper disable once CheckNamespace @@ -42,12 +41,9 @@ public static class NpgsqlRangeExtensions /// The value to locate in the range. /// The type of the elements of . /// - /// True if the range contains the specified value; otherwise, false. + /// true if the range contains the specified value; otherwise, false. /// - /// - /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static bool Contains(this NpgsqlRange range, T value) => throw new ClientEvaluationNotSupportedException(); + public static bool Contains(this NpgsqlRange range, T value) where T : IComparable => throw new NotSupportedException(); /// /// Determines whether a range contains a specified range. @@ -56,12 +52,9 @@ public static class NpgsqlRangeExtensions /// The specified range to locate in the range. /// The type of the elements of . /// - /// True if the range contains the specified range; otherwise, false. + /// true if the range contains the specified range; otherwise, false. /// - /// - /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static bool Contains(this NpgsqlRange a, NpgsqlRange b) => throw new ClientEvaluationNotSupportedException(); + public static bool Contains(this NpgsqlRange a, NpgsqlRange b) where T : IComparable => throw new NotSupportedException(); /// /// Determines whether a range is contained by a specified range. @@ -70,12 +63,9 @@ public static class NpgsqlRangeExtensions /// The range in which to locate the specified range. /// The type of the elements of . /// - /// True if the range contains the specified range; otherwise, false. + /// true if the range contains the specified range; otherwise, false. /// - /// - /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static bool ContainedBy(this NpgsqlRange a, NpgsqlRange b) => throw new ClientEvaluationNotSupportedException(); + public static bool ContainedBy(this NpgsqlRange a, NpgsqlRange b) where T : IComparable => b.Contains(a); /// /// Determines whether a range overlaps another range. @@ -84,12 +74,9 @@ public static class NpgsqlRangeExtensions /// The second range. /// The type of the elements of . /// - /// True if the ranges overlap (share points in common); otherwise, false. + /// true if the ranges overlap (share points in common); otherwise, false. /// - /// - /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static bool Overlaps(this NpgsqlRange a, NpgsqlRange b) => throw new ClientEvaluationNotSupportedException(); + public static bool Overlaps(this NpgsqlRange a, NpgsqlRange b) where T : IComparable => throw new NotSupportedException(); /// /// Determines whether a range is strictly to the left of another range. @@ -98,12 +85,9 @@ public static class NpgsqlRangeExtensions /// The second range. /// The type of the elements of . /// - /// True if the first range is strictly to the left of the second; otherwise, false. + /// true if the first range is strictly to the left of the second; otherwise, false. /// - /// - /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static bool IsStrictlyLeftOf(this NpgsqlRange a, NpgsqlRange b) => throw new ClientEvaluationNotSupportedException(); + public static bool IsStrictlyLeftOf(this NpgsqlRange a, NpgsqlRange b) where T : IComparable => throw new NotSupportedException(); /// /// Determines whether a range is strictly to the right of another range. @@ -112,12 +96,9 @@ public static class NpgsqlRangeExtensions /// The second range. /// The type of the elements of . /// - /// True if the first range is strictly to the right of the second; otherwise, false. + /// true if the first range is strictly to the right of the second; otherwise, false. /// - /// - /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static bool IsStrictlyRightOf(this NpgsqlRange a, NpgsqlRange b) => throw new ClientEvaluationNotSupportedException(); + public static bool IsStrictlyRightOf(this NpgsqlRange a, NpgsqlRange b) where T : IComparable => throw new NotSupportedException(); /// /// Determines whether a range does not extend to the left of another range. @@ -126,12 +107,9 @@ public static class NpgsqlRangeExtensions /// The second range. /// The type of the elements of . /// - /// True if the first range does not extend to the left of the second; otherwise, false. + /// true if the first range does not extend to the left of the second; otherwise, false. /// - /// - /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static bool DoesNotExtendLeftOf(this NpgsqlRange a, NpgsqlRange b) => throw new ClientEvaluationNotSupportedException(); + public static bool DoesNotExtendLeftOf(this NpgsqlRange a, NpgsqlRange b) where T : IComparable => throw new NotSupportedException(); /// /// Determines whether a range does not extend to the right of another range. @@ -140,12 +118,9 @@ public static class NpgsqlRangeExtensions /// The second range. /// The type of the elements of . /// - /// True if the first range does not extend to the right of the second; otherwise, false. + /// true if the first range does not extend to the right of the second; otherwise, false. /// - /// - /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static bool DoesNotExtendRightOf(this NpgsqlRange a, NpgsqlRange b) => throw new ClientEvaluationNotSupportedException(); + public static bool DoesNotExtendRightOf(this NpgsqlRange a, NpgsqlRange b) where T : IComparable => throw new NotSupportedException(); /// /// Determines whether a range is adjacent to another range. @@ -154,12 +129,9 @@ public static class NpgsqlRangeExtensions /// The second range. /// The type of the elements of . /// - /// True if the ranges are adjacent; otherwise, false. + /// true if the ranges are adjacent; otherwise, false. /// - /// - /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static bool IsAdjacentTo(this NpgsqlRange a, NpgsqlRange b) => throw new ClientEvaluationNotSupportedException(); + public static bool IsAdjacentTo(this NpgsqlRange a, NpgsqlRange b) where T : IComparable => throw new NotSupportedException(); /// /// Returns the set union, which means unique elements that appear in either of two ranges. @@ -170,10 +142,7 @@ public static class NpgsqlRangeExtensions /// /// The unique elements that appear in either range. /// - /// - /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static NpgsqlRange Union(this NpgsqlRange a, NpgsqlRange b) => throw new ClientEvaluationNotSupportedException(); + public static NpgsqlRange Union(this NpgsqlRange a, NpgsqlRange b) where T : IComparable => throw new NotSupportedException(); /// /// Returns the set intersection, which means elements that appear in each of two ranges. @@ -184,10 +153,7 @@ public static class NpgsqlRangeExtensions /// /// The elements that appear in both ranges. /// - /// - /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static NpgsqlRange Intersect(this NpgsqlRange a, NpgsqlRange b) => throw new ClientEvaluationNotSupportedException(); + public static NpgsqlRange Intersect(this NpgsqlRange a, NpgsqlRange b) where T : IComparable => throw new NotSupportedException(); /// /// Returns the set difference, which means the elements of one range that do not appear in a second range. @@ -198,9 +164,6 @@ public static class NpgsqlRangeExtensions /// /// The elements that appear in the first range, but not the second range. /// - /// - /// This method is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static NpgsqlRange Except(this NpgsqlRange a, NpgsqlRange b) => throw new ClientEvaluationNotSupportedException(); + public static NpgsqlRange Except(this NpgsqlRange a, NpgsqlRange b) where T : IComparable => throw new NotSupportedException(); } } diff --git a/src/EFCore.PG/Utilities/ClientEvaluationNotSupportedException.cs b/src/EFCore.PG/Utilities/ClientEvaluationNotSupportedException.cs deleted file mode 100644 index 8fce1fdbba..0000000000 --- a/src/EFCore.PG/Utilities/ClientEvaluationNotSupportedException.cs +++ /dev/null @@ -1,48 +0,0 @@ -#region License - -// The PostgreSQL License -// -// Copyright (C) 2016 The Npgsql Development Team -// -// Permission to use, copy, modify, and distribute this software and its -// documentation for any purpose, without fee, and without a written -// agreement is hereby granted, provided that the above copyright notice -// and this paragraph and the following two paragraphs appear in all copies. -// -// IN NO EVENT SHALL THE NPGSQL DEVELOPMENT TEAM BE LIABLE TO ANY PARTY -// FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, -// INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS -// DOCUMENTATION, EVEN IF THE NPGSQL DEVELOPMENT TEAM HAS BEEN ADVISED OF -// THE POSSIBILITY OF SUCH DAMAGE. -// -// THE NPGSQL DEVELOPMENT TEAM SPECIFICALLY DISCLAIMS ANY WARRANTIES, -// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -// AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS -// ON AN "AS IS" BASIS, AND THE NPGSQL DEVELOPMENT TEAM HAS NO OBLIGATIONS -// TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - -#endregion - -using System; -using System.Runtime.CompilerServices; - -namespace Npgsql.EntityFrameworkCore.PostgreSQL.Utilities -{ - /// - /// The exception that is thrown when a method intended for SQL translation is evaluated by the client. - /// - public class ClientEvaluationNotSupportedException : NotSupportedException - { - readonly string _callerMemberName; - - /// - public override string Message - => $"{_callerMemberName} is only intended for use via SQL translation as part of an EF Core LINQ query."; - - /// - public ClientEvaluationNotSupportedException([CallerMemberName] string method = default) - { - _callerMemberName = method; - } - } -}