MongoIdentityEvidence.cs 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* Copyright 2010-present MongoDB Inc.
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. using System;
  16. using System.Collections.Generic;
  17. using System.Linq;
  18. using System.Text;
  19. namespace MongoDB.Driver
  20. {
  21. /// <summary>
  22. /// Evidence used as proof of a MongoIdentity.
  23. /// </summary>
  24. public abstract class MongoIdentityEvidence
  25. {
  26. // constructors
  27. /// <summary>
  28. /// Initializes a new instance of the <see cref="MongoIdentityEvidence" /> class.
  29. /// </summary>
  30. internal MongoIdentityEvidence()
  31. { }
  32. // public operators
  33. /// <summary>
  34. /// Compares two MongoIdentityEvidences.
  35. /// </summary>
  36. /// <param name="lhs">The first MongoIdentityEvidence.</param>
  37. /// <param name="rhs">The other MongoIdentityEvidence.</param>
  38. /// <returns>True if the two MongoIdentityEvidences are equal (or both null).</returns>
  39. public static bool operator ==(MongoIdentityEvidence lhs, MongoIdentityEvidence rhs)
  40. {
  41. return object.Equals(lhs, rhs);
  42. }
  43. /// <summary>
  44. /// Compares two MongoIdentityEvidences.
  45. /// </summary>
  46. /// <param name="lhs">The first MongoIdentityEvidence.</param>
  47. /// <param name="rhs">The other MongoIdentityEvidence.</param>
  48. /// <returns>True if the two MongoIdentityEvidences are not equal (or one is null and the other is not).</returns>
  49. public static bool operator !=(MongoIdentityEvidence lhs, MongoIdentityEvidence rhs)
  50. {
  51. return !(lhs == rhs);
  52. }
  53. // public methods
  54. /// <summary>
  55. /// Determines whether the specified <see cref="System.Object" /> is equal to this instance.
  56. /// </summary>
  57. /// <param name="obj">The <see cref="System.Object" /> to compare with this instance.</param>
  58. /// <returns>
  59. /// <c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>.
  60. /// </returns>
  61. public abstract override bool Equals(object obj);
  62. /// <summary>
  63. /// Returns a hash code for this instance.
  64. /// </summary>
  65. /// <returns>
  66. /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
  67. /// </returns>
  68. public abstract override int GetHashCode();
  69. }
  70. }