From 65318c3783aa2277f9b72a736da491466ecc4fad Mon Sep 17 00:00:00 2001 From: Aaron Powell Date: Mon, 30 Dec 2024 15:59:16 +1100 Subject: [PATCH 1/4] Creating Aspire.Client project --- Aspire.sln | 7 +++++++ .../Aspire.Azure.AI.OpenAI.csproj | 2 +- .../Aspire.Azure.Data.Tables.csproj | 5 ++++- .../Aspire.Azure.Messaging.EventHubs.csproj | 5 ++++- .../Aspire.Azure.Messaging.ServiceBus.csproj | 5 ++++- .../Aspire.Azure.Messaging.WebPubSub.csproj | 5 ++++- .../Aspire.Azure.Search.Documents.csproj | 5 ++++- .../Aspire.Azure.Security.KeyVault.csproj | 5 ++++- .../Aspire.Azure.Storage.Blobs.csproj | 5 ++++- .../Aspire.Azure.Storage.Queues.csproj | 5 ++++- src/Components/Aspire.Client/Aspire.Client.csproj | 14 ++++++++++++++ .../HealthChecksExtensions.cs | 10 +++++++++- src/Components/Aspire.Client/PublicAPI.Shipped.txt | 0 .../Aspire.Client/PublicAPI.Unshipped.txt | 4 ++++ src/Components/Aspire.Client/README.md | 9 +++++++++ .../Aspire.Confluent.Kafka.csproj | 8 ++++---- .../Aspire.Elastic.Clients.Elasticsearch.csproj | 5 ++++- .../Aspire.Microsoft.Data.SqlClient.csproj | 5 ++++- ....Microsoft.EntityFrameworkCore.SqlServer.csproj | 5 ++++- .../Aspire.Milvus.Client.csproj | 5 ++++- .../Aspire.MongoDB.Driver.csproj | 5 ++++- .../Aspire.MySqlConnector.csproj | 5 ++++- .../Aspire.NATS.Net/Aspire.NATS.Net.csproj | 5 ++++- ...re.Npgsql.EntityFrameworkCore.PostgreSQL.csproj | 5 ++++- src/Components/Aspire.Npgsql/Aspire.Npgsql.csproj | 5 ++++- .../Aspire.Oracle.EntityFrameworkCore.csproj | 5 ++++- .../Aspire.Pomelo.EntityFrameworkCore.MySql.csproj | 5 ++++- .../Aspire.Qdrant.Client.csproj | 5 ++++- .../Aspire.RabbitMQ.Client.csproj | 5 ++++- src/Components/Aspire.Seq/Aspire.Seq.csproj | 5 ++++- .../Aspire.StackExchange.Redis.csproj | 5 ++++- 31 files changed, 140 insertions(+), 29 deletions(-) create mode 100644 src/Components/Aspire.Client/Aspire.Client.csproj rename src/Components/{Common => Aspire.Client}/HealthChecksExtensions.cs (68%) create mode 100644 src/Components/Aspire.Client/PublicAPI.Shipped.txt create mode 100644 src/Components/Aspire.Client/PublicAPI.Unshipped.txt create mode 100644 src/Components/Aspire.Client/README.md diff --git a/Aspire.sln b/Aspire.sln index 52a3a75f81..a3109bb4e0 100644 --- a/Aspire.sln +++ b/Aspire.sln @@ -631,6 +631,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DaprServiceC", "playground\ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Dashboard", "Dashboard", "{830F7CA9-8E51-4D62-832F-91F53F85B7AE}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aspire.Client", "src\Components\Aspire.Client\Aspire.Client.csproj", "{9551D5BD-F7A8-4537-98CC-56483F8A0A6B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1653,6 +1655,10 @@ Global {B26653B9-439E-4850-A7F8-43C6E5121952}.Debug|Any CPU.Build.0 = Debug|Any CPU {B26653B9-439E-4850-A7F8-43C6E5121952}.Release|Any CPU.ActiveCfg = Release|Any CPU {B26653B9-439E-4850-A7F8-43C6E5121952}.Release|Any CPU.Build.0 = Release|Any CPU + {9551D5BD-F7A8-4537-98CC-56483F8A0A6B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9551D5BD-F7A8-4537-98CC-56483F8A0A6B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9551D5BD-F7A8-4537-98CC-56483F8A0A6B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9551D5BD-F7A8-4537-98CC-56483F8A0A6B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1956,6 +1962,7 @@ Global {042DD8C6-A26C-4B06-80A1-FE7F8659C5BC} = {B7345F72-712F-436C-AE18-CAF7CDD4A990} {B26653B9-439E-4850-A7F8-43C6E5121952} = {57A42144-739E-49A7-BADB-BB8F5F20FA17} {830F7CA9-8E51-4D62-832F-91F53F85B7AE} = {4981B3A5-4AFD-4191-BF7D-8692D9783D60} + {9551D5BD-F7A8-4537-98CC-56483F8A0A6B} = {27381127-6C45-4B4C-8F18-41FF48DFE4B2} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {6DCEDFEC-988E-4CB3-B45B-191EB5086E0C} diff --git a/src/Components/Aspire.Azure.AI.OpenAI/Aspire.Azure.AI.OpenAI.csproj b/src/Components/Aspire.Azure.AI.OpenAI/Aspire.Azure.AI.OpenAI.csproj index 6a22fde1c9..948b84c084 100644 --- a/src/Components/Aspire.Azure.AI.OpenAI/Aspire.Azure.AI.OpenAI.csproj +++ b/src/Components/Aspire.Azure.AI.OpenAI/Aspire.Azure.AI.OpenAI.csproj @@ -18,7 +18,6 @@ - @@ -31,6 +30,7 @@ + diff --git a/src/Components/Aspire.Azure.Data.Tables/Aspire.Azure.Data.Tables.csproj b/src/Components/Aspire.Azure.Data.Tables/Aspire.Azure.Data.Tables.csproj index aa710f182b..1f8aeadc9a 100644 --- a/src/Components/Aspire.Azure.Data.Tables/Aspire.Azure.Data.Tables.csproj +++ b/src/Components/Aspire.Azure.Data.Tables/Aspire.Azure.Data.Tables.csproj @@ -16,7 +16,6 @@ - @@ -29,4 +28,8 @@ + + + + diff --git a/src/Components/Aspire.Azure.Messaging.EventHubs/Aspire.Azure.Messaging.EventHubs.csproj b/src/Components/Aspire.Azure.Messaging.EventHubs/Aspire.Azure.Messaging.EventHubs.csproj index 7d8f6a4ebc..a9667ba154 100644 --- a/src/Components/Aspire.Azure.Messaging.EventHubs/Aspire.Azure.Messaging.EventHubs.csproj +++ b/src/Components/Aspire.Azure.Messaging.EventHubs/Aspire.Azure.Messaging.EventHubs.csproj @@ -18,7 +18,6 @@ - @@ -29,5 +28,9 @@ + + + + diff --git a/src/Components/Aspire.Azure.Messaging.ServiceBus/Aspire.Azure.Messaging.ServiceBus.csproj b/src/Components/Aspire.Azure.Messaging.ServiceBus/Aspire.Azure.Messaging.ServiceBus.csproj index dfadc7fbff..0a266f9673 100644 --- a/src/Components/Aspire.Azure.Messaging.ServiceBus/Aspire.Azure.Messaging.ServiceBus.csproj +++ b/src/Components/Aspire.Azure.Messaging.ServiceBus/Aspire.Azure.Messaging.ServiceBus.csproj @@ -16,7 +16,6 @@ - @@ -28,5 +27,9 @@ + + + + diff --git a/src/Components/Aspire.Azure.Messaging.WebPubSub/Aspire.Azure.Messaging.WebPubSub.csproj b/src/Components/Aspire.Azure.Messaging.WebPubSub/Aspire.Azure.Messaging.WebPubSub.csproj index 526f00d132..5be4bb473c 100644 --- a/src/Components/Aspire.Azure.Messaging.WebPubSub/Aspire.Azure.Messaging.WebPubSub.csproj +++ b/src/Components/Aspire.Azure.Messaging.WebPubSub/Aspire.Azure.Messaging.WebPubSub.csproj @@ -16,7 +16,6 @@ - @@ -27,5 +26,9 @@ + + + + diff --git a/src/Components/Aspire.Azure.Search.Documents/Aspire.Azure.Search.Documents.csproj b/src/Components/Aspire.Azure.Search.Documents/Aspire.Azure.Search.Documents.csproj index 8da9dd3826..cf0e2e0422 100644 --- a/src/Components/Aspire.Azure.Search.Documents/Aspire.Azure.Search.Documents.csproj +++ b/src/Components/Aspire.Azure.Search.Documents/Aspire.Azure.Search.Documents.csproj @@ -16,7 +16,6 @@ - @@ -28,4 +27,8 @@ + + + + diff --git a/src/Components/Aspire.Azure.Security.KeyVault/Aspire.Azure.Security.KeyVault.csproj b/src/Components/Aspire.Azure.Security.KeyVault/Aspire.Azure.Security.KeyVault.csproj index 2458aea0eb..4531751eb3 100644 --- a/src/Components/Aspire.Azure.Security.KeyVault/Aspire.Azure.Security.KeyVault.csproj +++ b/src/Components/Aspire.Azure.Security.KeyVault/Aspire.Azure.Security.KeyVault.csproj @@ -16,7 +16,6 @@ - @@ -30,4 +29,8 @@ + + + + diff --git a/src/Components/Aspire.Azure.Storage.Blobs/Aspire.Azure.Storage.Blobs.csproj b/src/Components/Aspire.Azure.Storage.Blobs/Aspire.Azure.Storage.Blobs.csproj index e104594e2e..3bdf08f62c 100644 --- a/src/Components/Aspire.Azure.Storage.Blobs/Aspire.Azure.Storage.Blobs.csproj +++ b/src/Components/Aspire.Azure.Storage.Blobs/Aspire.Azure.Storage.Blobs.csproj @@ -16,7 +16,6 @@ - @@ -29,4 +28,8 @@ + + + + diff --git a/src/Components/Aspire.Azure.Storage.Queues/Aspire.Azure.Storage.Queues.csproj b/src/Components/Aspire.Azure.Storage.Queues/Aspire.Azure.Storage.Queues.csproj index 0d49fad1a4..1c1631f158 100644 --- a/src/Components/Aspire.Azure.Storage.Queues/Aspire.Azure.Storage.Queues.csproj +++ b/src/Components/Aspire.Azure.Storage.Queues/Aspire.Azure.Storage.Queues.csproj @@ -16,7 +16,6 @@ - @@ -29,4 +28,8 @@ + + + + diff --git a/src/Components/Aspire.Client/Aspire.Client.csproj b/src/Components/Aspire.Client/Aspire.Client.csproj new file mode 100644 index 0000000000..0e34e630f8 --- /dev/null +++ b/src/Components/Aspire.Client/Aspire.Client.csproj @@ -0,0 +1,14 @@ + + + $(DefaultTargetFramework) + true + aspire + A package containing utilities for building Aspire Client integrations. + $(SharedDir)As-ire_icon_256.png + + + + + + + diff --git a/src/Components/Common/HealthChecksExtensions.cs b/src/Components/Aspire.Client/HealthChecksExtensions.cs similarity index 68% rename from src/Components/Common/HealthChecksExtensions.cs rename to src/Components/Aspire.Client/HealthChecksExtensions.cs index 29e4762df2..5cc96a11f4 100644 --- a/src/Components/Common/HealthChecksExtensions.cs +++ b/src/Components/Aspire.Client/HealthChecksExtensions.cs @@ -7,11 +7,16 @@ namespace Aspire; -internal static class HealthChecksExtensions +/// +/// Provides extension methods for adding health checks to the IHostApplicationBuilder. +/// +public static class HealthChecksExtensions { /// /// Adds a HealthCheckRegistration if one hasn't already been added to the builder. /// + /// The IHostApplicationBuilder to add the health check to. + /// The HealthCheckRegistration to add. public static void TryAddHealthCheck(this IHostApplicationBuilder builder, HealthCheckRegistration healthCheckRegistration) { builder.TryAddHealthCheck(healthCheckRegistration.Name, hcBuilder => hcBuilder.Add(healthCheckRegistration)); @@ -20,6 +25,9 @@ public static void TryAddHealthCheck(this IHostApplicationBuilder builder, Healt /// /// Invokes the action if the given hasn't already been added to the builder. /// + /// The IHostApplicationBuilder to add the health check to. + /// The name of the health check. + /// The action to add the health check. public static void TryAddHealthCheck(this IHostApplicationBuilder builder, string name, Action addHealthCheck) { var healthCheckKey = $"Aspire.HealthChecks.{name}"; diff --git a/src/Components/Aspire.Client/PublicAPI.Shipped.txt b/src/Components/Aspire.Client/PublicAPI.Shipped.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/Components/Aspire.Client/PublicAPI.Unshipped.txt b/src/Components/Aspire.Client/PublicAPI.Unshipped.txt new file mode 100644 index 0000000000..883bdce501 --- /dev/null +++ b/src/Components/Aspire.Client/PublicAPI.Unshipped.txt @@ -0,0 +1,4 @@ +#nullable enable +Aspire.HealthChecksExtensions +static Aspire.HealthChecksExtensions.TryAddHealthCheck(this Microsoft.Extensions.Hosting.IHostApplicationBuilder! builder, Microsoft.Extensions.Diagnostics.HealthChecks.HealthCheckRegistration! healthCheckRegistration) -> void +static Aspire.HealthChecksExtensions.TryAddHealthCheck(this Microsoft.Extensions.Hosting.IHostApplicationBuilder! builder, string! name, System.Action! addHealthCheck) -> void diff --git a/src/Components/Aspire.Client/README.md b/src/Components/Aspire.Client/README.md new file mode 100644 index 0000000000..4e832fc199 --- /dev/null +++ b/src/Components/Aspire.Client/README.md @@ -0,0 +1,9 @@ +# Aspire.Client + +Provides a set of common services and utilities for .NET Aspire Client integration packages. + +This package provides no integration package-specific functionality. + +## Feedback & contributing + +https://github.com/dotnet/aspire diff --git a/src/Components/Aspire.Confluent.Kafka/Aspire.Confluent.Kafka.csproj b/src/Components/Aspire.Confluent.Kafka/Aspire.Confluent.Kafka.csproj index 0d150dc21a..b69934c202 100644 --- a/src/Components/Aspire.Confluent.Kafka/Aspire.Confluent.Kafka.csproj +++ b/src/Components/Aspire.Confluent.Kafka/Aspire.Confluent.Kafka.csproj @@ -12,10 +12,6 @@ 90 - - - - @@ -24,4 +20,8 @@ + + + + diff --git a/src/Components/Aspire.Elastic.Clients.Elasticsearch/Aspire.Elastic.Clients.Elasticsearch.csproj b/src/Components/Aspire.Elastic.Clients.Elasticsearch/Aspire.Elastic.Clients.Elasticsearch.csproj index 124ce1c8af..7a361442a5 100644 --- a/src/Components/Aspire.Elastic.Clients.Elasticsearch/Aspire.Elastic.Clients.Elasticsearch.csproj +++ b/src/Components/Aspire.Elastic.Clients.Elasticsearch/Aspire.Elastic.Clients.Elasticsearch.csproj @@ -14,7 +14,6 @@ - @@ -26,4 +25,8 @@ + + + + \ No newline at end of file diff --git a/src/Components/Aspire.Microsoft.Data.SqlClient/Aspire.Microsoft.Data.SqlClient.csproj b/src/Components/Aspire.Microsoft.Data.SqlClient/Aspire.Microsoft.Data.SqlClient.csproj index 519c915b5e..9543f78d9a 100644 --- a/src/Components/Aspire.Microsoft.Data.SqlClient/Aspire.Microsoft.Data.SqlClient.csproj +++ b/src/Components/Aspire.Microsoft.Data.SqlClient/Aspire.Microsoft.Data.SqlClient.csproj @@ -15,7 +15,6 @@ - @@ -32,4 +31,8 @@ + + + + diff --git a/src/Components/Aspire.Microsoft.EntityFrameworkCore.SqlServer/Aspire.Microsoft.EntityFrameworkCore.SqlServer.csproj b/src/Components/Aspire.Microsoft.EntityFrameworkCore.SqlServer/Aspire.Microsoft.EntityFrameworkCore.SqlServer.csproj index f1d2c0ded9..4fbb9d30d1 100644 --- a/src/Components/Aspire.Microsoft.EntityFrameworkCore.SqlServer/Aspire.Microsoft.EntityFrameworkCore.SqlServer.csproj +++ b/src/Components/Aspire.Microsoft.EntityFrameworkCore.SqlServer/Aspire.Microsoft.EntityFrameworkCore.SqlServer.csproj @@ -15,7 +15,6 @@ - @@ -31,5 +30,9 @@ + + + + diff --git a/src/Components/Aspire.Milvus.Client/Aspire.Milvus.Client.csproj b/src/Components/Aspire.Milvus.Client/Aspire.Milvus.Client.csproj index fdc34a0090..b2911b2af4 100644 --- a/src/Components/Aspire.Milvus.Client/Aspire.Milvus.Client.csproj +++ b/src/Components/Aspire.Milvus.Client/Aspire.Milvus.Client.csproj @@ -16,7 +16,6 @@ - @@ -26,4 +25,8 @@ + + + + diff --git a/src/Components/Aspire.MongoDB.Driver/Aspire.MongoDB.Driver.csproj b/src/Components/Aspire.MongoDB.Driver/Aspire.MongoDB.Driver.csproj index 351b1508c3..e15b30a297 100644 --- a/src/Components/Aspire.MongoDB.Driver/Aspire.MongoDB.Driver.csproj +++ b/src/Components/Aspire.MongoDB.Driver/Aspire.MongoDB.Driver.csproj @@ -15,7 +15,6 @@ - @@ -29,5 +28,9 @@ + + + + diff --git a/src/Components/Aspire.MySqlConnector/Aspire.MySqlConnector.csproj b/src/Components/Aspire.MySqlConnector/Aspire.MySqlConnector.csproj index ed436ee025..fb4ffdc155 100644 --- a/src/Components/Aspire.MySqlConnector/Aspire.MySqlConnector.csproj +++ b/src/Components/Aspire.MySqlConnector/Aspire.MySqlConnector.csproj @@ -14,7 +14,6 @@ - @@ -27,4 +26,8 @@ + + + + diff --git a/src/Components/Aspire.NATS.Net/Aspire.NATS.Net.csproj b/src/Components/Aspire.NATS.Net/Aspire.NATS.Net.csproj index a4eef5442f..4e9e76df55 100644 --- a/src/Components/Aspire.NATS.Net/Aspire.NATS.Net.csproj +++ b/src/Components/Aspire.NATS.Net/Aspire.NATS.Net.csproj @@ -14,7 +14,6 @@ - @@ -25,4 +24,8 @@ + + + + diff --git a/src/Components/Aspire.Npgsql.EntityFrameworkCore.PostgreSQL/Aspire.Npgsql.EntityFrameworkCore.PostgreSQL.csproj b/src/Components/Aspire.Npgsql.EntityFrameworkCore.PostgreSQL/Aspire.Npgsql.EntityFrameworkCore.PostgreSQL.csproj index 56cb268b65..90e478b8d8 100644 --- a/src/Components/Aspire.Npgsql.EntityFrameworkCore.PostgreSQL/Aspire.Npgsql.EntityFrameworkCore.PostgreSQL.csproj +++ b/src/Components/Aspire.Npgsql.EntityFrameworkCore.PostgreSQL/Aspire.Npgsql.EntityFrameworkCore.PostgreSQL.csproj @@ -17,7 +17,6 @@ - @@ -31,5 +30,9 @@ + + + + diff --git a/src/Components/Aspire.Npgsql/Aspire.Npgsql.csproj b/src/Components/Aspire.Npgsql/Aspire.Npgsql.csproj index 65f48ae5f5..a7036aaa8e 100644 --- a/src/Components/Aspire.Npgsql/Aspire.Npgsql.csproj +++ b/src/Components/Aspire.Npgsql/Aspire.Npgsql.csproj @@ -14,7 +14,6 @@ - @@ -28,4 +27,8 @@ + + + + diff --git a/src/Components/Aspire.Oracle.EntityFrameworkCore/Aspire.Oracle.EntityFrameworkCore.csproj b/src/Components/Aspire.Oracle.EntityFrameworkCore/Aspire.Oracle.EntityFrameworkCore.csproj index 18a646edc1..b2de0c926e 100644 --- a/src/Components/Aspire.Oracle.EntityFrameworkCore/Aspire.Oracle.EntityFrameworkCore.csproj +++ b/src/Components/Aspire.Oracle.EntityFrameworkCore/Aspire.Oracle.EntityFrameworkCore.csproj @@ -12,7 +12,6 @@ - @@ -27,4 +26,8 @@ + + + + diff --git a/src/Components/Aspire.Pomelo.EntityFrameworkCore.MySql/Aspire.Pomelo.EntityFrameworkCore.MySql.csproj b/src/Components/Aspire.Pomelo.EntityFrameworkCore.MySql/Aspire.Pomelo.EntityFrameworkCore.MySql.csproj index 44daebd83e..311449c264 100644 --- a/src/Components/Aspire.Pomelo.EntityFrameworkCore.MySql/Aspire.Pomelo.EntityFrameworkCore.MySql.csproj +++ b/src/Components/Aspire.Pomelo.EntityFrameworkCore.MySql/Aspire.Pomelo.EntityFrameworkCore.MySql.csproj @@ -14,7 +14,6 @@ - @@ -28,4 +27,8 @@ + + + + diff --git a/src/Components/Aspire.Qdrant.Client/Aspire.Qdrant.Client.csproj b/src/Components/Aspire.Qdrant.Client/Aspire.Qdrant.Client.csproj index 5690fc0e77..addb14d808 100644 --- a/src/Components/Aspire.Qdrant.Client/Aspire.Qdrant.Client.csproj +++ b/src/Components/Aspire.Qdrant.Client/Aspire.Qdrant.Client.csproj @@ -14,7 +14,6 @@ - @@ -23,5 +22,9 @@ + + + + diff --git a/src/Components/Aspire.RabbitMQ.Client/Aspire.RabbitMQ.Client.csproj b/src/Components/Aspire.RabbitMQ.Client/Aspire.RabbitMQ.Client.csproj index 6a0377be8d..74cbf5071d 100644 --- a/src/Components/Aspire.RabbitMQ.Client/Aspire.RabbitMQ.Client.csproj +++ b/src/Components/Aspire.RabbitMQ.Client/Aspire.RabbitMQ.Client.csproj @@ -14,7 +14,6 @@ - @@ -30,4 +29,8 @@ + + + + diff --git a/src/Components/Aspire.Seq/Aspire.Seq.csproj b/src/Components/Aspire.Seq/Aspire.Seq.csproj index d726b300e1..273d529f13 100644 --- a/src/Components/Aspire.Seq/Aspire.Seq.csproj +++ b/src/Components/Aspire.Seq/Aspire.Seq.csproj @@ -13,7 +13,6 @@ - @@ -24,4 +23,8 @@ + + + + diff --git a/src/Components/Aspire.StackExchange.Redis/Aspire.StackExchange.Redis.csproj b/src/Components/Aspire.StackExchange.Redis/Aspire.StackExchange.Redis.csproj index 7df684408d..99e92210ac 100644 --- a/src/Components/Aspire.StackExchange.Redis/Aspire.StackExchange.Redis.csproj +++ b/src/Components/Aspire.StackExchange.Redis/Aspire.StackExchange.Redis.csproj @@ -14,7 +14,6 @@ - @@ -34,5 +33,9 @@ + + + + From 7239a70f02e8ff4ac763c8a2835d76bd8e757db6 Mon Sep 17 00:00:00 2001 From: Aaron Powell Date: Mon, 30 Dec 2024 16:05:45 +1100 Subject: [PATCH 2/4] Adding ConfigurationSchemaAttribute and ConnectionStringValidation to Aspire.Client Removed shared references --- .../Aspire.Azure.AI.OpenAI.csproj | 1 - .../Aspire.Azure.Data.Tables.csproj | 1 - .../Aspire.Azure.Messaging.EventHubs.csproj | 1 - .../Aspire.Azure.Messaging.ServiceBus.csproj | 1 - .../Aspire.Azure.Messaging.WebPubSub.csproj | 1 - .../Aspire.Azure.Search.Documents.csproj | 1 - .../Aspire.Azure.Security.KeyVault.csproj | 1 - .../Aspire.Azure.Storage.Blobs.csproj | 1 - .../Aspire.Azure.Storage.Queues.csproj | 1 - .../ConfigurationSchemaAttributes.cs | 14 ++++++++++++-- .../ConnectionStringValidation.cs | 14 +++++++++++++- .../Aspire.Client/PublicAPI.Unshipped.txt | 11 +++++++++++ .../Aspire.Elastic.Clients.Elasticsearch.csproj | 4 ---- .../Aspire.Microsoft.Azure.Cosmos.csproj | 1 - .../Aspire.Microsoft.Data.SqlClient.csproj | 5 ----- ...ire.Microsoft.EntityFrameworkCore.Cosmos.csproj | 1 - ....Microsoft.EntityFrameworkCore.SqlServer.csproj | 2 -- .../Aspire.Milvus.Client.csproj | 4 ---- .../Aspire.MongoDB.Driver.csproj | 5 ----- .../Aspire.MySqlConnector.csproj | 5 ----- .../Aspire.NATS.Net/Aspire.NATS.Net.csproj | 4 ---- ...re.Npgsql.EntityFrameworkCore.PostgreSQL.csproj | 2 -- src/Components/Aspire.Npgsql/Aspire.Npgsql.csproj | 5 ----- src/Components/Aspire.OpenAI/Aspire.OpenAI.csproj | 4 ---- .../Aspire.Oracle.EntityFrameworkCore.csproj | 2 -- .../Aspire.Pomelo.EntityFrameworkCore.MySql.csproj | 2 -- .../Aspire.Qdrant.Client.csproj | 4 ---- .../Aspire.RabbitMQ.Client.csproj | 4 ---- src/Components/Aspire.Seq/Aspire.Seq.csproj | 4 ---- ...e.StackExchange.Redis.DistributedCaching.csproj | 4 ---- ...Aspire.StackExchange.Redis.OutputCaching.csproj | 4 ---- .../Aspire.StackExchange.Redis.csproj | 4 ---- 32 files changed, 36 insertions(+), 82 deletions(-) rename src/Components/{Common => Aspire.Client}/ConfigurationSchemaAttributes.cs (61%) rename src/Components/{Common => Aspire.Client}/ConnectionStringValidation.cs (56%) diff --git a/src/Components/Aspire.Azure.AI.OpenAI/Aspire.Azure.AI.OpenAI.csproj b/src/Components/Aspire.Azure.AI.OpenAI/Aspire.Azure.AI.OpenAI.csproj index 948b84c084..53ba82e1ea 100644 --- a/src/Components/Aspire.Azure.AI.OpenAI/Aspire.Azure.AI.OpenAI.csproj +++ b/src/Components/Aspire.Azure.AI.OpenAI/Aspire.Azure.AI.OpenAI.csproj @@ -17,7 +17,6 @@ - diff --git a/src/Components/Aspire.Azure.Data.Tables/Aspire.Azure.Data.Tables.csproj b/src/Components/Aspire.Azure.Data.Tables/Aspire.Azure.Data.Tables.csproj index 1f8aeadc9a..01e02978b5 100644 --- a/src/Components/Aspire.Azure.Data.Tables/Aspire.Azure.Data.Tables.csproj +++ b/src/Components/Aspire.Azure.Data.Tables/Aspire.Azure.Data.Tables.csproj @@ -15,7 +15,6 @@ - diff --git a/src/Components/Aspire.Azure.Messaging.EventHubs/Aspire.Azure.Messaging.EventHubs.csproj b/src/Components/Aspire.Azure.Messaging.EventHubs/Aspire.Azure.Messaging.EventHubs.csproj index a9667ba154..dfc0bf83f4 100644 --- a/src/Components/Aspire.Azure.Messaging.EventHubs/Aspire.Azure.Messaging.EventHubs.csproj +++ b/src/Components/Aspire.Azure.Messaging.EventHubs/Aspire.Azure.Messaging.EventHubs.csproj @@ -17,7 +17,6 @@ - diff --git a/src/Components/Aspire.Azure.Messaging.ServiceBus/Aspire.Azure.Messaging.ServiceBus.csproj b/src/Components/Aspire.Azure.Messaging.ServiceBus/Aspire.Azure.Messaging.ServiceBus.csproj index 0a266f9673..549c2d4dc9 100644 --- a/src/Components/Aspire.Azure.Messaging.ServiceBus/Aspire.Azure.Messaging.ServiceBus.csproj +++ b/src/Components/Aspire.Azure.Messaging.ServiceBus/Aspire.Azure.Messaging.ServiceBus.csproj @@ -15,7 +15,6 @@ - diff --git a/src/Components/Aspire.Azure.Messaging.WebPubSub/Aspire.Azure.Messaging.WebPubSub.csproj b/src/Components/Aspire.Azure.Messaging.WebPubSub/Aspire.Azure.Messaging.WebPubSub.csproj index 5be4bb473c..101077801f 100644 --- a/src/Components/Aspire.Azure.Messaging.WebPubSub/Aspire.Azure.Messaging.WebPubSub.csproj +++ b/src/Components/Aspire.Azure.Messaging.WebPubSub/Aspire.Azure.Messaging.WebPubSub.csproj @@ -15,7 +15,6 @@ - diff --git a/src/Components/Aspire.Azure.Search.Documents/Aspire.Azure.Search.Documents.csproj b/src/Components/Aspire.Azure.Search.Documents/Aspire.Azure.Search.Documents.csproj index cf0e2e0422..b458261bcf 100644 --- a/src/Components/Aspire.Azure.Search.Documents/Aspire.Azure.Search.Documents.csproj +++ b/src/Components/Aspire.Azure.Search.Documents/Aspire.Azure.Search.Documents.csproj @@ -15,7 +15,6 @@ - diff --git a/src/Components/Aspire.Azure.Security.KeyVault/Aspire.Azure.Security.KeyVault.csproj b/src/Components/Aspire.Azure.Security.KeyVault/Aspire.Azure.Security.KeyVault.csproj index 4531751eb3..260dd96520 100644 --- a/src/Components/Aspire.Azure.Security.KeyVault/Aspire.Azure.Security.KeyVault.csproj +++ b/src/Components/Aspire.Azure.Security.KeyVault/Aspire.Azure.Security.KeyVault.csproj @@ -15,7 +15,6 @@ - diff --git a/src/Components/Aspire.Azure.Storage.Blobs/Aspire.Azure.Storage.Blobs.csproj b/src/Components/Aspire.Azure.Storage.Blobs/Aspire.Azure.Storage.Blobs.csproj index 3bdf08f62c..6daa307aba 100644 --- a/src/Components/Aspire.Azure.Storage.Blobs/Aspire.Azure.Storage.Blobs.csproj +++ b/src/Components/Aspire.Azure.Storage.Blobs/Aspire.Azure.Storage.Blobs.csproj @@ -15,7 +15,6 @@ - diff --git a/src/Components/Aspire.Azure.Storage.Queues/Aspire.Azure.Storage.Queues.csproj b/src/Components/Aspire.Azure.Storage.Queues/Aspire.Azure.Storage.Queues.csproj index 1c1631f158..afacef0856 100644 --- a/src/Components/Aspire.Azure.Storage.Queues/Aspire.Azure.Storage.Queues.csproj +++ b/src/Components/Aspire.Azure.Storage.Queues/Aspire.Azure.Storage.Queues.csproj @@ -15,7 +15,6 @@ - diff --git a/src/Components/Common/ConfigurationSchemaAttributes.cs b/src/Components/Aspire.Client/ConfigurationSchemaAttributes.cs similarity index 61% rename from src/Components/Common/ConfigurationSchemaAttributes.cs rename to src/Components/Aspire.Client/ConfigurationSchemaAttributes.cs index 5b15afdd46..738622db6f 100644 --- a/src/Components/Common/ConfigurationSchemaAttributes.cs +++ b/src/Components/Aspire.Client/ConfigurationSchemaAttributes.cs @@ -7,8 +7,14 @@ namespace Aspire; /// Attribute used to automatically generate a JSON schema for a component's configuration. /// [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] -internal sealed class ConfigurationSchemaAttribute : Attribute +public sealed class ConfigurationSchemaAttribute : Attribute { + /// + /// Initializes a new instance of the class. + /// + /// The path corresponding to which config section binds to. + /// The type that is bound to the configuration. This type will be walked and generate a JSON schema for all the properties. + /// (optional) The config sections to exclude from the ConfigurationSchema. This is useful if there are properties you don't want to publicize in the config schema. public ConfigurationSchemaAttribute(string path, Type type, string[]? exclusionPaths = null) { Path = path; @@ -36,8 +42,12 @@ public ConfigurationSchemaAttribute(string path, Type type, string[]? exclusionP /// Provides information to describe the logging categories produced by a component. /// [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)] -internal sealed class LoggingCategoriesAttribute : Attribute +public sealed class LoggingCategoriesAttribute : Attribute { + /// + /// Initializes a new instance of the class. + /// + /// The list of log categories produced by the component. These categories will show up under the Logging:LogLevel section in appsettings.json. public LoggingCategoriesAttribute(params string[] categories) { Categories = categories; diff --git a/src/Components/Common/ConnectionStringValidation.cs b/src/Components/Aspire.Client/ConnectionStringValidation.cs similarity index 56% rename from src/Components/Common/ConnectionStringValidation.cs rename to src/Components/Aspire.Client/ConnectionStringValidation.cs index 23585611dd..737bf1a205 100644 --- a/src/Components/Common/ConnectionStringValidation.cs +++ b/src/Components/Aspire.Client/ConnectionStringValidation.cs @@ -3,8 +3,20 @@ namespace Aspire; -internal static class ConnectionStringValidation +/// +/// Provides a method to validate a connection string. +/// +public static class ConnectionStringValidation { + /// + /// Validates the provided connection string. + /// + /// The connection string to validate. + /// The name of the connection. + /// The default configuration section name. + /// The type-specific configuration section name (optional). + /// Indicates if it is EF design time (optional). + /// Thrown when the connection string is missing and it is not EF design time. public static void ValidateConnectionString(string? connectionString, string connectionName, string defaultConfigSectionName, string? typeSpecificSectionName = null, bool isEfDesignTime = false) { if (string.IsNullOrWhiteSpace(connectionString) && !isEfDesignTime) diff --git a/src/Components/Aspire.Client/PublicAPI.Unshipped.txt b/src/Components/Aspire.Client/PublicAPI.Unshipped.txt index 883bdce501..bd5b339e53 100644 --- a/src/Components/Aspire.Client/PublicAPI.Unshipped.txt +++ b/src/Components/Aspire.Client/PublicAPI.Unshipped.txt @@ -1,4 +1,15 @@ #nullable enable +Aspire.ConfigurationSchemaAttribute +Aspire.ConfigurationSchemaAttribute.ConfigurationSchemaAttribute(string! path, System.Type! type, string![]? exclusionPaths = null) -> void +Aspire.ConfigurationSchemaAttribute.ExclusionPaths.get -> string![]? +Aspire.ConfigurationSchemaAttribute.Path.get -> string! +Aspire.ConfigurationSchemaAttribute.Type.get -> System.Type! +Aspire.ConnectionStringValidation Aspire.HealthChecksExtensions +Aspire.LoggingCategoriesAttribute +Aspire.LoggingCategoriesAttribute.Categories.get -> string![]! +Aspire.LoggingCategoriesAttribute.Categories.set -> void +Aspire.LoggingCategoriesAttribute.LoggingCategoriesAttribute(params string![]! categories) -> void +static Aspire.ConnectionStringValidation.ValidateConnectionString(string? connectionString, string! connectionName, string! defaultConfigSectionName, string? typeSpecificSectionName = null, bool isEfDesignTime = false) -> void static Aspire.HealthChecksExtensions.TryAddHealthCheck(this Microsoft.Extensions.Hosting.IHostApplicationBuilder! builder, Microsoft.Extensions.Diagnostics.HealthChecks.HealthCheckRegistration! healthCheckRegistration) -> void static Aspire.HealthChecksExtensions.TryAddHealthCheck(this Microsoft.Extensions.Hosting.IHostApplicationBuilder! builder, string! name, System.Action! addHealthCheck) -> void diff --git a/src/Components/Aspire.Elastic.Clients.Elasticsearch/Aspire.Elastic.Clients.Elasticsearch.csproj b/src/Components/Aspire.Elastic.Clients.Elasticsearch/Aspire.Elastic.Clients.Elasticsearch.csproj index 7a361442a5..35c5f3e619 100644 --- a/src/Components/Aspire.Elastic.Clients.Elasticsearch/Aspire.Elastic.Clients.Elasticsearch.csproj +++ b/src/Components/Aspire.Elastic.Clients.Elasticsearch/Aspire.Elastic.Clients.Elasticsearch.csproj @@ -12,10 +12,6 @@ 80 - - - - diff --git a/src/Components/Aspire.Microsoft.Azure.Cosmos/Aspire.Microsoft.Azure.Cosmos.csproj b/src/Components/Aspire.Microsoft.Azure.Cosmos/Aspire.Microsoft.Azure.Cosmos.csproj index 74fcb5bf55..6146b4cbf4 100644 --- a/src/Components/Aspire.Microsoft.Azure.Cosmos/Aspire.Microsoft.Azure.Cosmos.csproj +++ b/src/Components/Aspire.Microsoft.Azure.Cosmos/Aspire.Microsoft.Azure.Cosmos.csproj @@ -14,7 +14,6 @@ - diff --git a/src/Components/Aspire.Microsoft.Data.SqlClient/Aspire.Microsoft.Data.SqlClient.csproj b/src/Components/Aspire.Microsoft.Data.SqlClient/Aspire.Microsoft.Data.SqlClient.csproj index 9543f78d9a..4312ba7321 100644 --- a/src/Components/Aspire.Microsoft.Data.SqlClient/Aspire.Microsoft.Data.SqlClient.csproj +++ b/src/Components/Aspire.Microsoft.Data.SqlClient/Aspire.Microsoft.Data.SqlClient.csproj @@ -13,11 +13,6 @@ 41 - - - - - diff --git a/src/Components/Aspire.Microsoft.EntityFrameworkCore.Cosmos/Aspire.Microsoft.EntityFrameworkCore.Cosmos.csproj b/src/Components/Aspire.Microsoft.EntityFrameworkCore.Cosmos/Aspire.Microsoft.EntityFrameworkCore.Cosmos.csproj index bc103e16bc..03b926cec2 100644 --- a/src/Components/Aspire.Microsoft.EntityFrameworkCore.Cosmos/Aspire.Microsoft.EntityFrameworkCore.Cosmos.csproj +++ b/src/Components/Aspire.Microsoft.EntityFrameworkCore.Cosmos/Aspire.Microsoft.EntityFrameworkCore.Cosmos.csproj @@ -14,7 +14,6 @@ - diff --git a/src/Components/Aspire.Microsoft.EntityFrameworkCore.SqlServer/Aspire.Microsoft.EntityFrameworkCore.SqlServer.csproj b/src/Components/Aspire.Microsoft.EntityFrameworkCore.SqlServer/Aspire.Microsoft.EntityFrameworkCore.SqlServer.csproj index 4fbb9d30d1..9def2fea5f 100644 --- a/src/Components/Aspire.Microsoft.EntityFrameworkCore.SqlServer/Aspire.Microsoft.EntityFrameworkCore.SqlServer.csproj +++ b/src/Components/Aspire.Microsoft.EntityFrameworkCore.SqlServer/Aspire.Microsoft.EntityFrameworkCore.SqlServer.csproj @@ -14,8 +14,6 @@ - - diff --git a/src/Components/Aspire.Milvus.Client/Aspire.Milvus.Client.csproj b/src/Components/Aspire.Milvus.Client/Aspire.Milvus.Client.csproj index b2911b2af4..c4e5783e43 100644 --- a/src/Components/Aspire.Milvus.Client/Aspire.Milvus.Client.csproj +++ b/src/Components/Aspire.Milvus.Client/Aspire.Milvus.Client.csproj @@ -14,10 +14,6 @@ 80 - - - - diff --git a/src/Components/Aspire.MongoDB.Driver/Aspire.MongoDB.Driver.csproj b/src/Components/Aspire.MongoDB.Driver/Aspire.MongoDB.Driver.csproj index e15b30a297..222f37686c 100644 --- a/src/Components/Aspire.MongoDB.Driver/Aspire.MongoDB.Driver.csproj +++ b/src/Components/Aspire.MongoDB.Driver/Aspire.MongoDB.Driver.csproj @@ -13,11 +13,6 @@ 86 - - - - - diff --git a/src/Components/Aspire.MySqlConnector/Aspire.MySqlConnector.csproj b/src/Components/Aspire.MySqlConnector/Aspire.MySqlConnector.csproj index fb4ffdc155..fb92ee77e2 100644 --- a/src/Components/Aspire.MySqlConnector/Aspire.MySqlConnector.csproj +++ b/src/Components/Aspire.MySqlConnector/Aspire.MySqlConnector.csproj @@ -12,11 +12,6 @@ 83 - - - - - diff --git a/src/Components/Aspire.NATS.Net/Aspire.NATS.Net.csproj b/src/Components/Aspire.NATS.Net/Aspire.NATS.Net.csproj index 4e9e76df55..01e191bf4a 100644 --- a/src/Components/Aspire.NATS.Net/Aspire.NATS.Net.csproj +++ b/src/Components/Aspire.NATS.Net/Aspire.NATS.Net.csproj @@ -12,10 +12,6 @@ 75 - - - - diff --git a/src/Components/Aspire.Npgsql.EntityFrameworkCore.PostgreSQL/Aspire.Npgsql.EntityFrameworkCore.PostgreSQL.csproj b/src/Components/Aspire.Npgsql.EntityFrameworkCore.PostgreSQL/Aspire.Npgsql.EntityFrameworkCore.PostgreSQL.csproj index 90e478b8d8..b04c8d6ca7 100644 --- a/src/Components/Aspire.Npgsql.EntityFrameworkCore.PostgreSQL/Aspire.Npgsql.EntityFrameworkCore.PostgreSQL.csproj +++ b/src/Components/Aspire.Npgsql.EntityFrameworkCore.PostgreSQL/Aspire.Npgsql.EntityFrameworkCore.PostgreSQL.csproj @@ -16,8 +16,6 @@ - - diff --git a/src/Components/Aspire.Npgsql/Aspire.Npgsql.csproj b/src/Components/Aspire.Npgsql/Aspire.Npgsql.csproj index a7036aaa8e..257cf6d6f6 100644 --- a/src/Components/Aspire.Npgsql/Aspire.Npgsql.csproj +++ b/src/Components/Aspire.Npgsql/Aspire.Npgsql.csproj @@ -12,11 +12,6 @@ 87 - - - - - diff --git a/src/Components/Aspire.OpenAI/Aspire.OpenAI.csproj b/src/Components/Aspire.OpenAI/Aspire.OpenAI.csproj index 288b16552a..83732c1317 100644 --- a/src/Components/Aspire.OpenAI/Aspire.OpenAI.csproj +++ b/src/Components/Aspire.OpenAI/Aspire.OpenAI.csproj @@ -14,10 +14,6 @@ 70 - - - - diff --git a/src/Components/Aspire.Oracle.EntityFrameworkCore/Aspire.Oracle.EntityFrameworkCore.csproj b/src/Components/Aspire.Oracle.EntityFrameworkCore/Aspire.Oracle.EntityFrameworkCore.csproj index b2de0c926e..7548622283 100644 --- a/src/Components/Aspire.Oracle.EntityFrameworkCore/Aspire.Oracle.EntityFrameworkCore.csproj +++ b/src/Components/Aspire.Oracle.EntityFrameworkCore/Aspire.Oracle.EntityFrameworkCore.csproj @@ -12,8 +12,6 @@ - - diff --git a/src/Components/Aspire.Pomelo.EntityFrameworkCore.MySql/Aspire.Pomelo.EntityFrameworkCore.MySql.csproj b/src/Components/Aspire.Pomelo.EntityFrameworkCore.MySql/Aspire.Pomelo.EntityFrameworkCore.MySql.csproj index 311449c264..6a2b1c896a 100644 --- a/src/Components/Aspire.Pomelo.EntityFrameworkCore.MySql/Aspire.Pomelo.EntityFrameworkCore.MySql.csproj +++ b/src/Components/Aspire.Pomelo.EntityFrameworkCore.MySql/Aspire.Pomelo.EntityFrameworkCore.MySql.csproj @@ -13,8 +13,6 @@ - - diff --git a/src/Components/Aspire.Qdrant.Client/Aspire.Qdrant.Client.csproj b/src/Components/Aspire.Qdrant.Client/Aspire.Qdrant.Client.csproj index addb14d808..8d5044e7da 100644 --- a/src/Components/Aspire.Qdrant.Client/Aspire.Qdrant.Client.csproj +++ b/src/Components/Aspire.Qdrant.Client/Aspire.Qdrant.Client.csproj @@ -12,10 +12,6 @@ 71 - - - - diff --git a/src/Components/Aspire.RabbitMQ.Client/Aspire.RabbitMQ.Client.csproj b/src/Components/Aspire.RabbitMQ.Client/Aspire.RabbitMQ.Client.csproj index 74cbf5071d..7df3b11c39 100644 --- a/src/Components/Aspire.RabbitMQ.Client/Aspire.RabbitMQ.Client.csproj +++ b/src/Components/Aspire.RabbitMQ.Client/Aspire.RabbitMQ.Client.csproj @@ -12,10 +12,6 @@ 80 - - - - diff --git a/src/Components/Aspire.Seq/Aspire.Seq.csproj b/src/Components/Aspire.Seq/Aspire.Seq.csproj index 273d529f13..2279433397 100644 --- a/src/Components/Aspire.Seq/Aspire.Seq.csproj +++ b/src/Components/Aspire.Seq/Aspire.Seq.csproj @@ -12,10 +12,6 @@ 55 - - - - diff --git a/src/Components/Aspire.StackExchange.Redis.DistributedCaching/Aspire.StackExchange.Redis.DistributedCaching.csproj b/src/Components/Aspire.StackExchange.Redis.DistributedCaching/Aspire.StackExchange.Redis.DistributedCaching.csproj index 57e1abb4e0..f03e86d682 100644 --- a/src/Components/Aspire.StackExchange.Redis.DistributedCaching/Aspire.StackExchange.Redis.DistributedCaching.csproj +++ b/src/Components/Aspire.StackExchange.Redis.DistributedCaching/Aspire.StackExchange.Redis.DistributedCaching.csproj @@ -12,10 +12,6 @@ 59 - - - - diff --git a/src/Components/Aspire.StackExchange.Redis.OutputCaching/Aspire.StackExchange.Redis.OutputCaching.csproj b/src/Components/Aspire.StackExchange.Redis.OutputCaching/Aspire.StackExchange.Redis.OutputCaching.csproj index 79c6bb1d46..3581037d10 100644 --- a/src/Components/Aspire.StackExchange.Redis.OutputCaching/Aspire.StackExchange.Redis.OutputCaching.csproj +++ b/src/Components/Aspire.StackExchange.Redis.OutputCaching/Aspire.StackExchange.Redis.OutputCaching.csproj @@ -12,10 +12,6 @@ 59 - - - - diff --git a/src/Components/Aspire.StackExchange.Redis/Aspire.StackExchange.Redis.csproj b/src/Components/Aspire.StackExchange.Redis/Aspire.StackExchange.Redis.csproj index 99e92210ac..e48d7c4d40 100644 --- a/src/Components/Aspire.StackExchange.Redis/Aspire.StackExchange.Redis.csproj +++ b/src/Components/Aspire.StackExchange.Redis/Aspire.StackExchange.Redis.csproj @@ -13,10 +13,6 @@ 42 - - - - From c945e1787217a507a392916cc12acbca241f6fc6 Mon Sep 17 00:00:00 2001 From: Aaron Powell Date: Mon, 30 Dec 2024 16:06:22 +1100 Subject: [PATCH 3/4] Moving type to its own file --- .../ConfigurationSchemaAttributes.cs | 21 ---------------- .../LoggingCategoriesAttribute.cs | 25 +++++++++++++++++++ 2 files changed, 25 insertions(+), 21 deletions(-) create mode 100644 src/Components/Aspire.Client/LoggingCategoriesAttribute.cs diff --git a/src/Components/Aspire.Client/ConfigurationSchemaAttributes.cs b/src/Components/Aspire.Client/ConfigurationSchemaAttributes.cs index 738622db6f..c2100c433a 100644 --- a/src/Components/Aspire.Client/ConfigurationSchemaAttributes.cs +++ b/src/Components/Aspire.Client/ConfigurationSchemaAttributes.cs @@ -37,24 +37,3 @@ public ConfigurationSchemaAttribute(string path, Type type, string[]? exclusionP /// public string[]? ExclusionPaths { get; } } - -/// -/// Provides information to describe the logging categories produced by a component. -/// -[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)] -public sealed class LoggingCategoriesAttribute : Attribute -{ - /// - /// Initializes a new instance of the class. - /// - /// The list of log categories produced by the component. These categories will show up under the Logging:LogLevel section in appsettings.json. - public LoggingCategoriesAttribute(params string[] categories) - { - Categories = categories; - } - - /// - /// The list of log categories produced by the component. These categories will show up under the Logging:LogLevel section in appsettings.json. - /// - public string[] Categories { get; set; } -} diff --git a/src/Components/Aspire.Client/LoggingCategoriesAttribute.cs b/src/Components/Aspire.Client/LoggingCategoriesAttribute.cs new file mode 100644 index 0000000000..47ab278b77 --- /dev/null +++ b/src/Components/Aspire.Client/LoggingCategoriesAttribute.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace Aspire; + +/// +/// Provides information to describe the logging categories produced by a component. +/// +[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)] +public sealed class LoggingCategoriesAttribute : Attribute +{ + /// + /// Initializes a new instance of the class. + /// + /// The list of log categories produced by the component. These categories will show up under the Logging:LogLevel section in appsettings.json. + public LoggingCategoriesAttribute(params string[] categories) + { + Categories = categories; + } + + /// + /// The list of log categories produced by the component. These categories will show up under the Logging:LogLevel section in appsettings.json. + /// + public string[] Categories { get; set; } +} From 65cc7144d5a922b483ecc09ffedc19e332243da4 Mon Sep 17 00:00:00 2001 From: Aaron Powell Date: Mon, 30 Dec 2024 16:07:13 +1100 Subject: [PATCH 4/4] Following code cleanup guidance and using primary constructor --- .../ConfigurationSchemaAttributes.cs | 26 +++++++------------ .../LoggingCategoriesAttribute.cs | 18 +++++-------- 2 files changed, 17 insertions(+), 27 deletions(-) diff --git a/src/Components/Aspire.Client/ConfigurationSchemaAttributes.cs b/src/Components/Aspire.Client/ConfigurationSchemaAttributes.cs index c2100c433a..b4424cbe37 100644 --- a/src/Components/Aspire.Client/ConfigurationSchemaAttributes.cs +++ b/src/Components/Aspire.Client/ConfigurationSchemaAttributes.cs @@ -6,34 +6,28 @@ namespace Aspire; /// /// Attribute used to automatically generate a JSON schema for a component's configuration. /// +/// +/// Initializes a new instance of the class. +/// +/// The path corresponding to which config section binds to. +/// The type that is bound to the configuration. This type will be walked and generate a JSON schema for all the properties. +/// (optional) The config sections to exclude from the ConfigurationSchema. This is useful if there are properties you don't want to publicize in the config schema. [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] -public sealed class ConfigurationSchemaAttribute : Attribute +public sealed class ConfigurationSchemaAttribute(string path, Type type, string[]? exclusionPaths = null) : Attribute { - /// - /// Initializes a new instance of the class. - /// - /// The path corresponding to which config section binds to. - /// The type that is bound to the configuration. This type will be walked and generate a JSON schema for all the properties. - /// (optional) The config sections to exclude from the ConfigurationSchema. This is useful if there are properties you don't want to publicize in the config schema. - public ConfigurationSchemaAttribute(string path, Type type, string[]? exclusionPaths = null) - { - Path = path; - Type = type; - ExclusionPaths = exclusionPaths; - } /// /// The path corresponding to which config section binds to. /// - public string Path { get; } + public string Path { get; } = path; /// /// The type that is bound to the configuration. This type will be walked and generate a JSON schema for all the properties. /// - public Type Type { get; } + public Type Type { get; } = type; /// /// (optional) The config sections to exclude from the ConfigurationSchema. This is useful if there are properties you don't want to publicize in the config schema. /// - public string[]? ExclusionPaths { get; } + public string[]? ExclusionPaths { get; } = exclusionPaths; } diff --git a/src/Components/Aspire.Client/LoggingCategoriesAttribute.cs b/src/Components/Aspire.Client/LoggingCategoriesAttribute.cs index 47ab278b77..95728ccc65 100644 --- a/src/Components/Aspire.Client/LoggingCategoriesAttribute.cs +++ b/src/Components/Aspire.Client/LoggingCategoriesAttribute.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace Aspire; @@ -6,20 +6,16 @@ namespace Aspire; /// /// Provides information to describe the logging categories produced by a component. /// +/// +/// Initializes a new instance of the class. +/// +/// The list of log categories produced by the component. These categories will show up under the Logging:LogLevel section in appsettings.json. [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)] -public sealed class LoggingCategoriesAttribute : Attribute +public sealed class LoggingCategoriesAttribute(params string[] categories) : Attribute { - /// - /// Initializes a new instance of the class. - /// - /// The list of log categories produced by the component. These categories will show up under the Logging:LogLevel section in appsettings.json. - public LoggingCategoriesAttribute(params string[] categories) - { - Categories = categories; - } /// /// The list of log categories produced by the component. These categories will show up under the Logging:LogLevel section in appsettings.json. /// - public string[] Categories { get; set; } + public string[] Categories { get; set; } = categories; }