| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | namespace Azure.Messaging.ServiceBus.Management |
| | 5 | | { |
| | 6 | | /// <summary> |
| | 7 | | /// Matches all the messages arriving to be selected for the subscription. |
| | 8 | | /// </summary> |
| | 9 | | public sealed class TrueRuleFilter : SqlRuleFilter |
| | 10 | | { |
| 2 | 11 | | internal static readonly TrueRuleFilter Default = new TrueRuleFilter(); |
| | 12 | |
|
| | 13 | | /// <summary> |
| | 14 | | /// Initializes a new instance of the <see cref="TrueRuleFilter" /> class. |
| | 15 | | /// </summary> |
| | 16 | | public TrueRuleFilter() |
| 26 | 17 | | : base("1=1") |
| | 18 | | { |
| 26 | 19 | | } |
| | 20 | |
|
| | 21 | | internal override RuleFilter Clone() => |
| 8 | 22 | | new TrueRuleFilter(); |
| | 23 | |
|
| | 24 | | /// <summary> |
| | 25 | | /// Converts the value of the current instance to its equivalent string representation. |
| | 26 | | /// </summary> |
| | 27 | | /// <returns>A string representation of the current instance.</returns> |
| | 28 | | public override string ToString() |
| | 29 | | { |
| 0 | 30 | | return "TrueRuleFilter"; |
| | 31 | | } |
| | 32 | |
|
| | 33 | | /// <inheritdoc/> |
| | 34 | | public override int GetHashCode() |
| | 35 | | { |
| 0 | 36 | | return base.GetHashCode(); |
| | 37 | | } |
| | 38 | |
|
| | 39 | | /// <inheritdoc/> |
| | 40 | | public override bool Equals(object obj) |
| | 41 | | { |
| 0 | 42 | | return obj is TrueRuleFilter; |
| | 43 | | } |
| | 44 | |
|
| | 45 | | /// <inheritdoc/> |
| | 46 | | public override bool Equals(RuleFilter other) |
| | 47 | | { |
| 8 | 48 | | return other is TrueRuleFilter; |
| | 49 | | } |
| | 50 | |
|
| | 51 | | /// <summary> |
| | 52 | | /// |
| | 53 | | /// </summary> |
| | 54 | | /// <param name="left"></param> |
| | 55 | | /// <param name="right"></param> |
| | 56 | | /// <returns></returns> |
| | 57 | | public static bool operator ==(TrueRuleFilter left, TrueRuleFilter right) |
| | 58 | | { |
| 0 | 59 | | if (ReferenceEquals(left, right)) |
| | 60 | | { |
| 0 | 61 | | return true; |
| | 62 | | } |
| | 63 | |
|
| 0 | 64 | | if (ReferenceEquals(left, null) || ReferenceEquals(right, null)) |
| | 65 | | { |
| 0 | 66 | | return false; |
| | 67 | | } |
| | 68 | |
|
| 0 | 69 | | return left.Equals(right); |
| | 70 | | } |
| | 71 | |
|
| | 72 | | /// <summary> |
| | 73 | | /// |
| | 74 | | /// </summary> |
| | 75 | | /// <param name="left"></param> |
| | 76 | | /// <param name="right"></param> |
| | 77 | | /// <returns></returns> |
| | 78 | | public static bool operator !=(TrueRuleFilter left, TrueRuleFilter right) |
| | 79 | | { |
| 0 | 80 | | return !(left == right); |
| | 81 | | } |
| | 82 | | } |
| | 83 | | } |