Make TagHelperDescriptor and friends IEquatable
This commit is contained in:
parent
b6aa6b8099
commit
feb5f395d2
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
|
|
@ -9,7 +10,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution
|
|||
/// <summary>
|
||||
/// A metadata class describing a tag helper attribute.
|
||||
/// </summary>
|
||||
public abstract class BoundAttributeDescriptor
|
||||
public abstract class BoundAttributeDescriptor : IEquatable<BoundAttributeDescriptor>
|
||||
{
|
||||
protected BoundAttributeDescriptor(string kind)
|
||||
{
|
||||
|
|
@ -49,5 +50,20 @@ namespace Microsoft.AspNetCore.Razor.Evolution
|
|||
return anyErrors;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Equals(BoundAttributeDescriptor other)
|
||||
{
|
||||
return BoundAttributeDescriptorComparer.Default.Equals(this, other);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return Equals(obj as BoundAttributeDescriptor);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return BoundAttributeDescriptorComparer.Default.GetHashCode(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +1,13 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Evolution
|
||||
{
|
||||
public abstract class TagHelperDescriptor
|
||||
public abstract class TagHelperDescriptor : IEquatable<TagHelperDescriptor>
|
||||
{
|
||||
private IEnumerable<RazorDiagnostic> _allDiagnostics;
|
||||
|
||||
|
|
@ -60,5 +61,20 @@ namespace Microsoft.AspNetCore.Razor.Evolution
|
|||
|
||||
return _allDiagnostics;
|
||||
}
|
||||
|
||||
public bool Equals(TagHelperDescriptor other)
|
||||
{
|
||||
return TagHelperDescriptorComparer.Default.Equals(this, other);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return Equals(obj as TagHelperDescriptor);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return TagHelperDescriptorComparer.Default.GetHashCode(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using Microsoft.Extensions.Internal;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Evolution.Legacy
|
||||
namespace Microsoft.AspNetCore.Razor.Evolution
|
||||
{
|
||||
internal class TagHelperDescriptorComparer : IEqualityComparer<TagHelperDescriptor>
|
||||
{
|
||||
|
|
@ -1,12 +1,13 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Evolution
|
||||
{
|
||||
public abstract class TagMatchingRule
|
||||
public abstract class TagMatchingRule : IEquatable<TagMatchingRule>
|
||||
{
|
||||
private IEnumerable<RazorDiagnostic> _allDiagnostics;
|
||||
|
||||
|
|
@ -42,5 +43,20 @@ namespace Microsoft.AspNetCore.Razor.Evolution
|
|||
|
||||
return _allDiagnostics;
|
||||
}
|
||||
|
||||
public bool Equals(TagMatchingRule other)
|
||||
{
|
||||
return TagMatchingRuleComparer.Default.Equals(this, other);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return Equals(obj as TagMatchingRule);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return TagMatchingRuleComparer.Default.GetHashCode(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue