Skip to content

Commit

Permalink
Merge pull request #85 from HicServices/feature/nequ
Browse files Browse the repository at this point in the history
Equ not needed, only handled comparing two strings anyway....
  • Loading branch information
JFriel authored Oct 23, 2024
2 parents 951dc63 + 95011d1 commit be33a2b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
1 change: 0 additions & 1 deletion Packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@
| RestSharp | [GitHub](https://github.com/restsharp/RestSharp) | [Apache 2.0](https://github.com/restsharp/RestSharp/blob/dev/LICENSE.txt) | REST API wrapper | |
| System.ServiceModel.Http | [GitHub](https://github.com/dotnet/corefx) | [MIT](https://opensource.org/licenses/MIT) | Enables interaction with Web APIs (SciStore) | |
| Microsoft.XmlSerializer.Generator | [Microsoft](https://learn.microsoft.com/en-us/dotnet/core/additional-tools/xml-serializer-generator) | [MIT](https://opensource.org/licenses/MIT) | XML handling improvements |
| Equ | [GitHub](https://github.com/thedmi/Equ) | [MIT](https://opensource.org/licenses/MIT) | Fast, convention-based, zero-code equality functions for .NET |
1 change: 0 additions & 1 deletion SCIStorePlugin/SCIStorePlugin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@
<Compile Include="..\SharedAssemblyInfo.cs" Link="SharedAssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Equ" Version="2.3.0" />
<PackageReference Include="Microsoft.XmlSerializer.Generator" Version="8.0.0" />
<PackageReference Include="System.ServiceModel.Http" Version="6.2.0" />
</ItemGroup>
Expand Down
15 changes: 10 additions & 5 deletions SCIStorePlugin/SciStoreRecord.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
using System;
using Rdmp.Core.ReusableLibraryCode;
using Equ;
using Rdmp.Core.ReusableLibraryCode.Annotations;

namespace SCIStorePlugin;

public sealed class SciStoreRecord : PropertywiseEquatable<SciStoreRecord>, IEquatable<SciStoreRecord>
public sealed class SciStoreRecord : IEquatable<SciStoreRecord>
{
public string CHI;

Expand All @@ -28,7 +27,6 @@ public string TestReportID
private string _labNumber;
private string _testReportId;

[MemberwiseEqualityIgnore]
public string Dept { get; set; }

public static bool operator ==([CanBeNull] SciStoreRecord left, [CanBeNull] SciStoreRecord right)
Expand All @@ -43,11 +41,18 @@ public string TestReportID

public override bool Equals(object obj)
{
return obj is SciStoreRecord r && Equals(r);
return ReferenceEquals(this, obj) || obj is SciStoreRecord other && Equals(other);
}

public override int GetHashCode()
{
return HashCode.Combine(LabNumber, TestReportID);
return HashCode.Combine(_labNumber, _testReportId);
}

public bool Equals(SciStoreRecord other)
{
if (other is null) return false;
if (ReferenceEquals(this, other)) return true;
return _labNumber == other._labNumber && _testReportId == other._testReportId;
}
}

0 comments on commit be33a2b

Please sign in to comment.