Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Extensions] Add a namespace for extension methods to prevent possible naming clashes #1776

Merged
merged 5 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@page "/icon-explorer"
@using FluentUI.Demo.AssetExplorer.Components.Controls
@using Microsoft.FluentUI.AspNetCore.Components.Extensions

<PageTitle>FluentUI Blazor - Icon Explorers</PageTitle>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Logging;
using Microsoft.FluentUI.AspNetCore.Components;
using Microsoft.FluentUI.AspNetCore.Components.Extensions;

namespace FluentUI.Demo.Shared.Components;

Expand Down
66 changes: 36 additions & 30 deletions examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion examples/Demo/Shared/_Imports.razor
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
@using Microsoft.Extensions.Logging;

@using Microsoft.FluentUI.AspNetCore.Components
@using Microsoft.FluentUI.AspNetCore.Components.Extensions
@using Microsoft.FluentUI.AspNetCore.Components.DesignTokens

@using Microsoft.JSInterop
@using Microsoft.JSInterop
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Globalization;
using Microsoft.AspNetCore.Components;
using Microsoft.FluentUI.AspNetCore.Components.Extensions;
using Microsoft.FluentUI.AspNetCore.Components.Utilities;

namespace Microsoft.FluentUI.AspNetCore.Components;
Expand Down
1 change: 1 addition & 0 deletions src/Core/Components/DateTime/CalendarExtended.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Globalization;
using Microsoft.FluentUI.AspNetCore.Components.Extensions;

namespace Microsoft.FluentUI.AspNetCore.Components;

Expand Down
2 changes: 2 additions & 0 deletions src/Core/Components/DateTime/CalendarTitles.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

using Microsoft.FluentUI.AspNetCore.Components.Extensions;

namespace Microsoft.FluentUI.AspNetCore.Components;

internal class CalendarTitles
Expand Down
1 change: 1 addition & 0 deletions src/Core/Components/DateTime/FluentCalendar.razor.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.FluentUI.AspNetCore.Components.Extensions;
using Microsoft.FluentUI.AspNetCore.Components.Utilities;

namespace Microsoft.FluentUI.AspNetCore.Components;
Expand Down
2 changes: 2 additions & 0 deletions src/Core/Components/DateTime/FluentCalendarMonth.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using Microsoft.FluentUI.AspNetCore.Components.Extensions;

namespace Microsoft.FluentUI.AspNetCore.Components;

/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions src/Core/Components/DateTime/FluentCalendarYear.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using Microsoft.FluentUI.AspNetCore.Components.Extensions;

namespace Microsoft.FluentUI.AspNetCore.Components;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Globalization;
using System.Text.Json;
using Microsoft.AspNetCore.Components;
using Microsoft.FluentUI.AspNetCore.Components.Extensions;
using Microsoft.JSInterop;

namespace Microsoft.FluentUI.AspNetCore.Components;
Expand Down
1 change: 1 addition & 0 deletions src/Core/Components/Grid/FluentGridItem.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// --------------------------------------------------------------

using Microsoft.AspNetCore.Components;
using Microsoft.FluentUI.AspNetCore.Components.Extensions;
using Microsoft.FluentUI.AspNetCore.Components.Utilities;

namespace Microsoft.FluentUI.AspNetCore.Components;
Expand Down
1 change: 1 addition & 0 deletions src/Core/Components/Icons/FluentIcon.razor.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.FluentUI.AspNetCore.Components.Extensions;
using Microsoft.FluentUI.AspNetCore.Components.Utilities;

namespace Microsoft.FluentUI.AspNetCore.Components;
Expand Down
1 change: 1 addition & 0 deletions src/Core/Components/Icons/Icon.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Components;
using Microsoft.FluentUI.AspNetCore.Components.Extensions;
using Microsoft.FluentUI.AspNetCore.Components.Utilities;

namespace Microsoft.FluentUI.AspNetCore.Components;
Expand Down
1 change: 1 addition & 0 deletions src/Core/Components/Label/FluentLabel.razor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Components;
using Microsoft.FluentUI.AspNetCore.Components.Extensions;
using Microsoft.FluentUI.AspNetCore.Components.Utilities;

namespace Microsoft.FluentUI.AspNetCore.Components;
Expand Down
1 change: 1 addition & 0 deletions src/Core/Components/Menu/FluentMenuItem.razor.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.FluentUI.AspNetCore.Components.Extensions;

namespace Microsoft.FluentUI.AspNetCore.Components;

Expand Down
1 change: 1 addition & 0 deletions src/Core/Components/Radio/FluentRadioGroup.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//using System.Globalization;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.FluentUI.AspNetCore.Components.Extensions;

namespace Microsoft.FluentUI.AspNetCore.Components;

Expand Down
1 change: 1 addition & 0 deletions src/Core/Components/Slider/FluentSlider.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Globalization;

using Microsoft.AspNetCore.Components;
using Microsoft.FluentUI.AspNetCore.Components.Extensions;
using Microsoft.FluentUI.AspNetCore.Components.Utilities;
using Microsoft.JSInterop;

Expand Down
1 change: 1 addition & 0 deletions src/Core/Components/TextField/FluentTextField.razor.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNetCore.Components;
using Microsoft.FluentUI.AspNetCore.Components.Extensions;
using Microsoft.JSInterop;

namespace Microsoft.FluentUI.AspNetCore.Components;
Expand Down
4 changes: 2 additions & 2 deletions src/Core/Extensions/AdditionalAttributesExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Microsoft.FluentUI.AspNetCore.Components;
namespace Microsoft.FluentUI.AspNetCore.Components.Extensions;

public static class AdditionalAttributesExtensions
internal static class AdditionalAttributesExtensions
{
/// <summary> Determines whether two sets of attributes are equal when rendered. </summary>
/// <param name="x">The compared set</param>
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Extensions/BooleanExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Microsoft.FluentUI.AspNetCore.Components;
namespace Microsoft.FluentUI.AspNetCore.Components.Extensions;

internal static class BooleanExtensions
{
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Extensions/DateTimeExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Globalization;

namespace Microsoft.FluentUI.AspNetCore.Components;
namespace Microsoft.FluentUI.AspNetCore.Components.Extensions;

/// <summary>
/// Extension methods for <see cref="DateTime"/>.
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Extensions/EnumExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.ComponentModel;
using System.Reflection;

namespace Microsoft.FluentUI.AspNetCore.Components;
namespace Microsoft.FluentUI.AspNetCore.Components.Extensions;

public static class EnumExtensions
{
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Extensions/FluentInputExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Globalization;
using Microsoft.AspNetCore.Components;

namespace Microsoft.FluentUI.AspNetCore.Components;
namespace Microsoft.FluentUI.AspNetCore.Components.Extensions;

internal static class FluentInputExtensions
{
Expand Down
1 change: 1 addition & 0 deletions src/Core/Extensions/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Microsoft.FluentUI.AspNetCore.Components.Components.Tooltip;
using Microsoft.FluentUI.AspNetCore.Components.DesignTokens;

// This namespace is deliberately "Components" and not "Components.Extensions".
namespace Microsoft.FluentUI.AspNetCore.Components;

public static class ServiceCollectionExtensions
Expand Down
10 changes: 0 additions & 10 deletions src/Core/Extensions/StringExtensions.cs

This file was deleted.

1 change: 1 addition & 0 deletions src/Core/_Imports.razor
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
@using Microsoft.JSInterop
@using Microsoft.FluentUI.AspNetCore.Components
@using Microsoft.FluentUI.AspNetCore.Components.Infrastructure
@using Microsoft.FluentUI.AspNetCore.Components.Extensions
1 change: 1 addition & 0 deletions tests/Core/DateTime/FluentCalendarTests.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@using System.Globalization
@using Microsoft.FluentUI.AspNetCore.Components.Extensions
@using Xunit
@inherits TestContext

Expand Down
1 change: 1 addition & 0 deletions tests/Core/DateTime/ToDateTimeExtensionsTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Microsoft.FluentUI.AspNetCore.Components.Extensions;
using Xunit;

namespace Microsoft.FluentUI.AspNetCore.Components.Tests.DateTime;
Expand Down
1 change: 1 addition & 0 deletions tests/Core/DateTime/ToTimeAgoTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Microsoft.FluentUI.AspNetCore.Components.Extensions;
using Xunit;

namespace Microsoft.FluentUI.AspNetCore.Components.Tests.DateTime;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections;
using Microsoft.FluentUI.AspNetCore.Components.Extensions;
using Xunit;

namespace Microsoft.FluentUI.AspNetCore.Components.Tests.Extensions;
Expand Down
Loading