Easy.Net.Starter 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package Easy.Net.Starter --version 1.0.2
                    
NuGet\Install-Package Easy.Net.Starter -Version 1.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Easy.Net.Starter" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Easy.Net.Starter" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Easy.Net.Starter" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Easy.Net.Starter --version 1.0.2
                    
#r "nuget: Easy.Net.Starter, 1.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=Easy.Net.Starter&version=1.0.2
                    
Install Easy.Net.Starter as a Cake Addin
#tool nuget:?package=Easy.Net.Starter&version=1.0.2
                    
Install Easy.Net.Starter as a Cake Tool

ConfigurationLibrary

ConfigurationLibrary est une bibliothèque .NET conçue pour simplifier la configuration des applications Console et API. Elle offre une solution facile et intuitive pour gérer :

  • La configuration via des fichiers appsettings.json.
  • La gestion centralisée des logs.
  • L'initialisation rapide de la configuration pour différents environnements.

Fonctionnalités

  • Support de appsettings.json : Chargement et gestion des configurations via JSON avec support des sections hiérarchiques.
  • Gestion des environnements : Configure automatiquement les environnements (Development, Production, etc.).
  • Intégration des logs : Prise en charge de la journalisation via ILogger avec une configuration simplifiée pour Console, File ou tout autre fournisseur.
  • Extension facile : Ajoutez vos propres paramètres personnalisés grâce à des mécanismes d’injection de dépendances.

Installation

Ajoutez ConfigurationLibrary à votre projet via NuGet :

Install-Package ConfigurationLibrary

Ou via la CLI .NET :

dotnet add package ConfigurationLibrary

Utilisation

1. Initialisation dans une Application Console

Ajoutez et configurez appsettings.json :

{
  "AppSettings": {
    "Setting1": "Valeur1",
    "Setting2": "Valeur2"
  },
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning"
    }
  }
}

Exemple de configuration dans Program.cs :

using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;

class Program
{
    static void Main(string[] args)
    {
        // ConfigurationBuilder pour charger appsettings.json
        var configuration = new ConfigurationBuilder()
            .SetBasePath(AppContext.BaseDirectory)
            .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
            .Build();

        // Configuration des services et des logs
        var serviceCollection = new ServiceCollection()
            .AddLogging(builder =>
            {
                builder.AddConsole();
                builder.AddConfiguration(configuration.GetSection("Logging"));
            })
            .AddSingleton<IConfiguration>(configuration);

        var serviceProvider = serviceCollection.BuildServiceProvider();

        // Exemple d'utilisation de la configuration et des logs
        var logger = serviceProvider.GetRequiredService<ILogger<Program>>();
        var setting1 = configuration["AppSettings:Setting1"];

        logger.LogInformation($"Setting1: {setting1}");
    }
}

2. Initialisation dans une API ASP.NET Core

Ajoutez ConfigurationLibrary pour configurer les logs et fichiers de configuration dans Program.cs :

var builder = WebApplication.CreateBuilder(args);

// Configuration des logs et de appsettings.json
builder.Host.ConfigureLogging(logging =>
{
    logging.ClearProviders();
    logging.AddConsole();
})
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);

var app = builder.Build();

app.MapGet("/", () => "Hello World!");
app.Run();

Contribution

Les contributions sont les bienvenues ! Si vous souhaitez signaler un bug ou proposer une nouvelle fonctionnalité :

  1. Forkez le repository.
  2. Créez une branche pour votre fonctionnalité ou correctif (git checkout -b feature/nouvelle-fonctionnalite).
  3. Effectuez vos modifications.
  4. Créez une Pull Request.

Licence

Ce projet est sous licence MIT.


Avenir du Projet

Nous prévoyons d’ajouter prochainement :

  • Support des configurations via des sources distantes (par exemple, Azure App Configuration).
  • Intégration avec d'autres bibliothèques populaires comme Serilog et NLog.
  • Plus d'exemples d'utilisation dans divers scénarios.

Auteur

VotreNom
Pour toute question ou demande, n'hésitez pas à me contacter.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
9.6.2 182 4/23/2025
9.6.1 160 4/23/2025
9.6.0 153 4/23/2025
9.4.22 154 3/31/2025
9.4.21 137 3/31/2025
9.4.20 141 3/31/2025
9.4.19 125 3/30/2025
9.4.18 122 3/30/2025
9.4.17 128 3/30/2025
9.4.16 122 3/30/2025
9.4.15 124 3/30/2025
9.4.14 125 3/30/2025
9.4.13 126 3/30/2025
9.4.12 126 3/30/2025
9.4.11 130 3/30/2025
9.4.10 122 3/30/2025
9.4.9 127 3/30/2025
9.4.8 138 3/30/2025
9.4.7 131 3/30/2025
9.4.6 74 3/29/2025
9.4.5 77 3/29/2025
9.4.4 82 3/29/2025
9.4.3 77 3/29/2025
9.4.1 78 3/29/2025
9.4.0 79 3/29/2025
9.3.4 119 3/26/2025
9.3.3 120 3/26/2025
9.3.2 122 3/26/2025
9.3.1 121 3/26/2025
9.3.0 120 3/26/2025
9.2.18 460 3/25/2025
9.2.17 105 2/23/2025
9.2.16 96 2/22/2025
9.2.15 91 2/22/2025
9.2.14 99 2/19/2025
9.2.13 98 2/19/2025
9.2.12 97 2/16/2025
9.2.11 102 2/16/2025
9.2.10 99 2/15/2025
9.2.9 95 2/14/2025
9.2.8 88 2/14/2025
9.2.7 101 2/14/2025
9.2.6 92 2/14/2025
9.2.5 95 2/14/2025
9.2.4 100 2/14/2025
9.2.3 100 2/13/2025
9.2.2 95 2/13/2025
9.2.1 96 2/13/2025
9.2.0 97 2/13/2025
9.1.8 102 2/13/2025
9.1.7 111 2/9/2025
9.1.6 98 2/9/2025
9.1.5 106 2/9/2025
9.1.4 105 2/1/2025
9.1.3 95 2/1/2025
9.1.2 98 2/1/2025
9.1.1 95 2/1/2025
9.1.0 97 2/1/2025
9.0.34 96 1/6/2025
9.0.33 124 1/3/2025
9.0.32 118 1/3/2025
9.0.31 122 1/3/2025
9.0.30 121 1/3/2025
9.0.29 109 1/2/2025
9.0.28 109 1/2/2025
9.0.27 104 1/2/2025
9.0.26 107 1/2/2025
9.0.25 101 1/2/2025
9.0.24 101 1/2/2025
9.0.23 106 1/2/2025
9.0.22 104 1/2/2025
9.0.21 107 1/2/2025
9.0.20 102 1/2/2025
9.0.19 103 1/2/2025
9.0.18 104 1/2/2025
9.0.17 101 12/27/2024
9.0.16 94 12/27/2024
9.0.15 95 12/27/2024
9.0.14 91 12/27/2024
9.0.13 94 12/27/2024
9.0.12 88 12/27/2024
9.0.9 97 12/26/2024
9.0.8 97 12/25/2024
9.0.7 90 12/25/2024
9.0.6 102 12/25/2024
9.0.5 102 12/25/2024
9.0.4 99 12/24/2024
1.0.3 98 12/24/2024
1.0.2 93 12/24/2024
1.0.1 100 12/24/2024
1.0.0 99 12/24/2024