Phymnary.SugarPot.Module
1.0.2
dotnet add package Phymnary.SugarPot.Module --version 1.0.2
NuGet\Install-Package Phymnary.SugarPot.Module -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="Phymnary.SugarPot.Module" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Phymnary.SugarPot.Module" Version="1.0.2" />
<PackageReference Include="Phymnary.SugarPot.Module" />
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 Phymnary.SugarPot.Module --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Phymnary.SugarPot.Module, 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.
#:package Phymnary.SugarPot.Module@1.0.2
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Phymnary.SugarPot.Module&version=1.0.2
#tool nuget:?package=Phymnary.SugarPot.Module&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Phymnary.SugarPot.Module
Lightweight module helpers for .NET applications.
This project provides a small module pattern to organize service registration and configuration binding in a consistent way.
Features
IModulecontract for module-based service registrationAddModule<TModule>()extension forIHostApplicationBuilder- Optional integration with
IAutoRegisterfromPhymnary.SugarPot.DependencyInjection IAppSettingsSectionpattern for strongly-typed configuration sectionsConfigureSection<TConfig>()helpers for binding and validating options- Utility extension methods for strings, enums, collections, reflection attributes, and enumerables
Installation
Install Phymnary.SugarPot.Module from NuGet Package Manager.
Quick Start
1) Create a module
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Phymnary.SugarPot.Module;
public sealed class UserModule : IModule
{
public void ConfigureServices(IServiceCollection services, IConfigurationManager configuration)
{
services.AddOptions();
}
}
2) Register the module
using Phymnary.SugarPot.Module.Extensions;
var builder = Host.CreateApplicationBuilder(args);
builder.AddModule<UserModule>();
Configuration Section Binding
Define config model
using Phymnary.SugarPot.Module;
public sealed class JwtOptions : IAppSettingsSection
{
public static string Section => "Jwt";
public string Issuer { get; set; } = string.Empty;
public string Audience { get; set; } = string.Empty;
}
Bind section
using Phymnary.SugarPot.Module.Extensions;
services.ConfigureSection<JwtOptions>();
Bind section with validator
services.ConfigureSection<JwtOptions, JwtOptionsValidator>();
Extension Method Highlights
PascalToKebabCase()SplitBySemicolon()IsBlank(),TryGetValuable(),IsTruthy()TryGetExplicit()for enumsAddIfNotExisted()AppendIfNotNull(),WhereNotNull(),JoinAsString()HasAttribute<TAttribute>()
Target Frameworks
- .NET Standard 2.1
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. 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. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.0)
- Phymnary.SugarPot.DependencyInjection (>= 1.0.2)
-
net8.0
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.0)
- Phymnary.SugarPot.DependencyInjection (>= 1.0.2)
-
net9.0
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.0)
- Phymnary.SugarPot.DependencyInjection (>= 1.0.2)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Phymnary.SugarPot.Module:
| Package | Downloads |
|---|---|
|
Phymnary.SugarPot.AspNetCore.Domain
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.