| | | 1 | | // Copyright (c) Microsoft. All rights reserved. |
| | | 2 | | // Licensed under the MIT license. See LICENSE file in the project root for full license information. |
| | | 3 | | |
| | | 4 | | namespace Microsoft.Azure.ServiceBus |
| | | 5 | | { |
| | | 6 | | /// <summary> |
| | | 7 | | /// Matches all the messages arriving to be selected for the subscription. |
| | | 8 | | /// </summary> |
| | | 9 | | public sealed class TrueFilter : SqlFilter |
| | | 10 | | { |
| | 0 | 11 | | internal static readonly TrueFilter Default = new TrueFilter(); |
| | | 12 | | |
| | | 13 | | /// <summary> |
| | | 14 | | /// Initializes a new instance of the <see cref="TrueFilter" /> class. |
| | | 15 | | /// </summary> |
| | | 16 | | public TrueFilter() |
| | 0 | 17 | | : base("1=1") |
| | | 18 | | { |
| | 0 | 19 | | } |
| | | 20 | | |
| | | 21 | | /// <summary> |
| | | 22 | | /// Converts the value of the current instance to its equivalent string representation. |
| | | 23 | | /// </summary> |
| | | 24 | | /// <returns>A string representation of the current instance.</returns> |
| | | 25 | | public override string ToString() |
| | | 26 | | { |
| | 0 | 27 | | return "TrueFilter"; |
| | | 28 | | } |
| | | 29 | | |
| | | 30 | | public override int GetHashCode() |
| | | 31 | | { |
| | 0 | 32 | | return base.GetHashCode(); |
| | | 33 | | } |
| | | 34 | | |
| | | 35 | | public override bool Equals(object obj) |
| | | 36 | | { |
| | 0 | 37 | | return obj is TrueFilter; |
| | | 38 | | } |
| | | 39 | | |
| | | 40 | | public override bool Equals(Filter other) |
| | | 41 | | { |
| | 0 | 42 | | return other is TrueFilter; |
| | | 43 | | } |
| | | 44 | | |
| | | 45 | | public static bool operator ==(TrueFilter o1, TrueFilter o2) |
| | | 46 | | { |
| | 0 | 47 | | if (ReferenceEquals(o1, o2)) |
| | | 48 | | { |
| | 0 | 49 | | return true; |
| | | 50 | | } |
| | | 51 | | |
| | 0 | 52 | | if (ReferenceEquals(o1, null) || ReferenceEquals(o2, null)) |
| | | 53 | | { |
| | 0 | 54 | | return false; |
| | | 55 | | } |
| | | 56 | | |
| | 0 | 57 | | return o1.Equals(o2); |
| | | 58 | | } |
| | | 59 | | |
| | | 60 | | public static bool operator !=(TrueFilter o1, TrueFilter o2) |
| | | 61 | | { |
| | 0 | 62 | | return !(o1 == o2); |
| | | 63 | | } |
| | | 64 | | } |
| | | 65 | | } |