Skip to content

Use consistent comparer for resource names - #1710

Merged
Drew Noakes (drewnoakes) merged 1 commit into
microsoft:mainfrom
drewnoakes:resource-name-comparers
Jan 19, 2024
Merged

Drew Noakes (drewnoakes) merged 1 commit into
microsoft:mainfrom
drewnoakes:resource-name-comparers

Conversation

@drewnoakes

@drewnoakes Drew Noakes (drewnoakes) commented Jan 19, 2024 •

Copy link
Copy Markdown
Member

In #1691 the semantics around comparisons of resource names changed to make them case-insensitive. This change needs to be applied in some other places, for consistency.

We have a StringComparers class which denotes the comparison style for different types of values. This change extends the use of that type, and changes the value for ResourceName from Ordinal to OrdinalIgnoreCase.

It also moves that internal type into the Aspire namespace so that it's picked up by both projects that link it (Aspire.Hosting and Aspire.Dashboard) without needing to choose a namespace from either one, which then wouldn't make sense in the other.

Microsoft Reviewers: Open in CodeFlow

In microsoft#1691 the semantics around comparisons of resource names changed to make them case-insensitive. This change needs to be applied in some other places, for consistency.

We have a `StringComparers` class which denotes the comparison style for different types of values. This change extends the use of that type, and changes the value for `ResourceName` from `Ordinal` to `OrdinalIgnoreCase`.

It also moves that internal type into the `Aspire` namespace so that it's picked up by both projects that link it (`Aspire.Hosting` and `Aspire.Dashboard`) without needing to choose a namespace from either one, which then wouldn't make sense in the other.
@ghost ghost added the area-dashboard label Jan 19, 2024
@drewnoakes Drew Noakes (drewnoakes) added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Jan 19, 2024
// The .NET Foundation licenses this file to you under the MIT license.

namespace Aspire.Dashboard.Utils;
namespace Aspire;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this to shared code directory: https://github.com/dotnet/aspire/tree/main/src/Shared

Referencing files from other projects can create unexpected results.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed there were other places this happens. I created an issue: #1711

@drewnoakes
Drew Noakes (drewnoakes) merged commit cf253f7 into microsoft:main Jan 19, 2024
@drewnoakes
Drew Noakes (drewnoakes) deleted the resource-name-comparers branch January 19, 2024 05:22
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication area-dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants