JT.UtilityManager 1.0.0

dotnet add package JT.UtilityManager --version 1.0.0
                    
NuGet\Install-Package JT.UtilityManager -Version 1.0.0
                    
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="JT.UtilityManager" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="JT.UtilityManager" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="JT.UtilityManager" />
                    
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 JT.UtilityManager --version 1.0.0
                    
#r "nuget: JT.UtilityManager, 1.0.0"
                    
#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 JT.UtilityManager@1.0.0
                    
#: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=JT.UtilityManager&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=JT.UtilityManager&version=1.0.0
                    
Install as a Cake Tool

๐Ÿงฐ JT.UtilityManager

A modular and extensible .NET utility library that simplifies integration of core application features like caching (in-memory & Redis), health checks, CORS, and future-ready tools such as file conversion, email sender, logging, and more.


๐Ÿ”— GitHub Repository of JT.UtilityManager <br> ๐Ÿ”— GitHub Repository of Unit Test <br> ๐Ÿ”— GitHub Repository of Sample Demo to learn how to use it

๐Ÿš€ Features

Category Feature Status
๐Ÿง  Caching In-Memory Cache โœ… Ready
๐Ÿ” Distributed Redis Cache (via StackExchange) โœ… Ready
โค๏ธ Monitoring Health Checks โœ… Ready
๐ŸŒ Networking CORS Policy Configuration ๐Ÿ›  Planned
๐Ÿ“„ Conversion Word, PDF, CSV, JSON (Planned) ๐Ÿ›  Planned
๐Ÿ“ง Communication Email Sending ๐Ÿ›  Planned
๐Ÿ” Security Encryption/Decryption Utilities ๐Ÿ›  Planned
๐Ÿ” Resiliency Retry Policies ๐Ÿ›  Planned
๐Ÿชต Logging Abstracted Logging Helpers ๐Ÿ›  Planned

๐Ÿ“ฆ NuGet Installation

dotnet add package JT.UtilityManager

๐Ÿ›  Setup

Register Everything

builder.Services.AddUtilityManager(builder.Configuration);

Internally adds one by one according to the requirements:

builder.Services.AddInMemoryCaching();

builder.Services.AddRedisCaching();

builder.Services.AddHealthChecks();

builder.Services.AddCors();

โš™๏ธ Configuration (Example)

{
  "Redis": {
    "ConnectionString": "localhost:6379"
  }
}

๐Ÿงช Usage Examples

โœ… In-Memory Cache


public class ProductService
{
    private readonly IInMemoryCache _cache;

    public ProductService(IInMemoryCache cache)
    {
        _cache = cache;
    }

    public async Task<Product?> GetProductAsync(int id)
    {
        var key = $"product-{id}";
        return await _cache.GetOrSetAsync(key, () =>
        {
            // Fetch from DB or any external source
            return Task.FromResult(new Product { Id = id, Name = "Sample" });
        }, TimeSpan.FromMinutes(10));
    }
}

๐Ÿ” Redis Distributed Cache

public class SessionService
{
    private readonly IDistributedCacheService _redis;

    public SessionService(IDistributedCacheService redis)
    {
        _redis = redis;
    }

    public async Task StoreSessionAsync(string userId, SessionData data)
    {
        await _redis.SetAsync($"session:{userId}", data, TimeSpan.FromHours(1));
    }

    public async Task<SessionData?> GetSessionAsync(string userId)
    {
        return await _redis.GetAsync<SessionData>($"session:{userId}");
    }
}

โค๏ธ Health Check Endpoint

app.MapHealthChecks("/health");

๐ŸŒ CORS Configuration

A default policy is already added:

builder.Services.AddCors(options =>
{
    options.AddDefaultPolicy(policy =>
        policy.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());
});

You can override this in your own Program.cs.

๐Ÿ‘ฉโ€๐Ÿ’ป Contributing

Want to add logging, email, file conversion or encryption support? Great! Open an issue or submit a pull request.

Ideas to Contribute:

๐Ÿ”’ JWT Helper or Auth Middlewares

๐Ÿ“ค SMTP + SendGrid email integration

๐Ÿ“Š Telemetry wrapper for App Insights

๐Ÿ“„ File parsing & format conversion (PDF/Excel)

๐Ÿ“„ License

This library is licensed under the <a href="https://mit-license.org/"> MIT License</a>.

๐Ÿ”— Related Package on Nuget

<a href="https://www.nuget.org/packages/JT.SmartConfigManager/">SmartConfigManager</a>

Hi, I'm [Jayant Tripathy][<a href="https://jayanttripathy.com">website</a>] ๐Ÿ‘‹ <img src="https://komarev.com/ghpvc/?username=JayantTripathy" alt="cprespider" align="center" />

  • ๐ŸŒฑ Iโ€™m currently learning advanced concepts of AWS and Azure

  • ๐Ÿ‘ฏ Iโ€™m looking to collaborate with other content creators on [<a href="https://www.youtube.com/@JayantT">YouTube</a>]

  • ๐Ÿฅ… 2024-2025 Goals: get 10k subscribers on YouTube

  • โšก Fun fact: I love to watch cricket & listen to songs

                         ๐Ÿ”ง Built and maintained with โค๏ธ by Jayant Tripathy
    
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.  net10.0 was computed.  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.

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
1.0.0 236 7/13/2025