From 250f0a97d22eea3d9b0baed45e44ef0b8b509fee Mon Sep 17 00:00:00 2001 From: Philippe Matray Date: Sun, 11 Feb 2024 14:11:05 +0100 Subject: [PATCH] replace dependency Microsoft.Extensions.DependencyInjection by Microsoft.Extensions.DependencyInjection.Abstractions --- README.md | 37 +++++++++---------- .../MainExtensions.RegisterAppServices().md | 4 +- .../MasterCommander.ConsoleApp.csproj | 6 +++ .../MasterCommander.ConsoleApp/Program.cs | 4 ++ src/library/MasterCommander/MainExtensions.cs | 5 +-- .../MasterCommander/MasterCommander.csproj | 6 +-- 6 files changed, 33 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 50fe7e5..86e171c 100644 --- a/README.md +++ b/README.md @@ -34,15 +34,15 @@ Write code, not commands. MasterCommander provides a simple, consistent interfac * [Roadmap (next features)](#roadmap-next-features) * [๐Ÿ“ฅ Installation](#-installation) * [๐Ÿ“‹ Prerequisites](#-prerequisites) - * [From NuGet](#from-nuget) - * [From Source](#from-source) - * [๐Ÿš€ We use the latest C# features](#-we-use-the-latest-c-features) + * [๐Ÿš€ From Source](#-from-source) + * [We use the latest C# features](#we-use-the-latest-c-features) * [๐Ÿ“ฆ NuGet Packages](#-nuget-packages) - * [๐Ÿงช Tests Specifications](#-tests-specifications) * [๐Ÿ“Š Code Quality](#-code-quality) - * [โ“ Issues and Feature Requests](#-issues-and-feature-requests) + * [๐Ÿงช Tests Specifications](#-tests-specifications) * [๐Ÿค Contributing](#-contributing) - * [๐ŸŒŸ Contributors](#-contributors) + * [How to contribute?](#how-to-contribute) + * [Contributors](#contributors) + * [โ“ Issues and Feature Requests](#-issues-and-feature-requests) * [โœ‰๏ธ Contact](#-contact) * [๐Ÿ“œ License](#-license) @@ -123,15 +123,15 @@ To use MasterCommander, ensure you have the following installed on your system: - Docker (optional) - Node.js and npm (optional) -### From NuGet +#### We use the latest C# features -To install MasterCommander, you can use the NuGet package manager. Run the following command in your terminal: +This library targets .NET 8.0 and uses the latest C# features. It is written in C# 12.0 and uses the new `init` +properties, `record` types, `switch` expressions, `using` declarations and more. -```shell -dotnet add package MasterCommander --version 1.0.0-alpha.0.40 -``` +I invite you to read the [C# 12.0 documentation](https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-12) to +learn more about these features. -### From Source +### ๐Ÿš€ From Source You can also build MasterCommander from source. Follow these steps to get started: @@ -140,16 +140,13 @@ You can also build MasterCommander from source. Follow these steps to get starte 3. Run the application with `dotnet run` from within the source directory. 4. Or... open the project in Visual Studio (or JetBrains Rider) and run the application from the IDE. +### ๐Ÿ“ฆ NuGet Packages -### ๐Ÿš€ We use the latest C# features - -This library targets .NET 8.0 and uses the latest C# features. It is written in C# 12.0 and uses the new `init` -properties, `record` types, `switch` expressions, `using` declarations and more. - -I invite you to read the [C# 12.0 documentation](https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-12) to -learn more about these features. +To install MasterCommander, you can use the NuGet package manager. Run the following command in your terminal: -### ๐Ÿ“ฆ NuGet Packages +```shell +dotnet add package MasterCommander --version 1.0.0-alpha.0.40 +``` | Package Name | NuGet Version Badge | NuGet Downloads Badge | Package Explorer | |--------------------------------------|----------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------|--------------------------------------------------------| diff --git a/docs/master-commander/MainExtensions.RegisterAppServices().md b/docs/master-commander/MainExtensions.RegisterAppServices().md index f335b33..b7a042b 100644 --- a/docs/master-commander/MainExtensions.RegisterAppServices().md +++ b/docs/master-commander/MainExtensions.RegisterAppServices().md @@ -6,9 +6,9 @@ Provides extension methods for setting up application services. ```csharp -public static MasterCommander.Core.Services.IProjectInitializationService RegisterAppServices(); +public static Microsoft.Extensions.DependencyInjection.ServiceCollection RegisterAppServices(); ``` #### Returns -[IProjectInitializationService](IProjectInitializationService.md 'MasterCommander.Core.Services.IProjectInitializationService') +[Microsoft.Extensions.DependencyInjection.ServiceCollection](https://docs.microsoft.com/en-us/dotnet/api/Microsoft.Extensions.DependencyInjection.ServiceCollection 'Microsoft.Extensions.DependencyInjection.ServiceCollection') The project initialization service. \ No newline at end of file diff --git a/src/demo/MasterCommander.ConsoleApp/MasterCommander.ConsoleApp.csproj b/src/demo/MasterCommander.ConsoleApp/MasterCommander.ConsoleApp.csproj index d77ab64..c131f7f 100644 --- a/src/demo/MasterCommander.ConsoleApp/MasterCommander.ConsoleApp.csproj +++ b/src/demo/MasterCommander.ConsoleApp/MasterCommander.ConsoleApp.csproj @@ -8,8 +8,14 @@ IDE0005 + + + + + + diff --git a/src/demo/MasterCommander.ConsoleApp/Program.cs b/src/demo/MasterCommander.ConsoleApp/Program.cs index 5e33552..e8241f0 100644 --- a/src/demo/MasterCommander.ConsoleApp/Program.cs +++ b/src/demo/MasterCommander.ConsoleApp/Program.cs @@ -3,8 +3,12 @@ // See the LICENSE file in the project root for full license information. using MasterCommander; +using MasterCommander.Core.Services; +using Microsoft.Extensions.DependencyInjection; // create a new .NET solution and console application await MainExtensions .RegisterAppServices() + .BuildServiceProvider() + .GetRequiredService() .InitializeConsoleProjectAsync(); diff --git a/src/library/MasterCommander/MainExtensions.cs b/src/library/MasterCommander/MainExtensions.cs index ed2fc9a..db88f0a 100644 --- a/src/library/MasterCommander/MainExtensions.cs +++ b/src/library/MasterCommander/MainExtensions.cs @@ -16,7 +16,7 @@ public static class MainExtensions /// Provides extension methods for setting up application services. /// /// The project initialization service. - public static IProjectInitializationService RegisterAppServices() + public static ServiceCollection RegisterAppServices() { var services = new ServiceCollection(); @@ -28,8 +28,7 @@ public static IProjectInitializationService RegisterAppServices() // Register higher-level services services.AddScoped(); - var serviceProvider = services.BuildServiceProvider(); - return serviceProvider.GetRequiredService(); + return services; } private static void ConfigureDirectoryService(IServiceCollection services) diff --git a/src/library/MasterCommander/MasterCommander.csproj b/src/library/MasterCommander/MasterCommander.csproj index faa0abf..efb7e80 100644 --- a/src/library/MasterCommander/MasterCommander.csproj +++ b/src/library/MasterCommander/MasterCommander.csproj @@ -14,11 +14,9 @@ + - - - - +