Ragom.Toolkit 1.0.1

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

Ragom.Toolkit

A lightweight, production-ready .NET utility toolkit providing reusable extensions, helpers, security utilities, HTTP services, OTP generation, and numeric/text processing tools.

Designed for clean architecture, high reusability, and zero external dependencies.


๐Ÿš€ Features

  • ๐Ÿ“… Date & Time utilities (IST support, parsing, formatting, conversions)
  • ๐Ÿ”„ Safe type conversion extensions (int, long, decimal, double, float, bool, Guid, enum, DateTime, TimeSpan)
  • ๐Ÿงพ Enum helpers with caching and description support
  • ๐Ÿ“ File system utilities and file handling helpers
  • ๐ŸŽจ String & formatting utilities (phone, currency, masking, title case, cleanup)
  • ๐ŸŒ URL normalization and query utilities
  • โœ… Validation helpers (email, numeric, null-safe checks)
  • ๐Ÿงฉ Dynamic SQL models and query condition builders
  • ๐Ÿ—„๏ธ Advanced DbHelper utilities for SQL Server
  • โšก INSERT, UPDATE, UPSERT database operations
  • ๐Ÿ” Generic object mapping from SQL queries
  • ๐Ÿ” SQL injection-safe parameter handling
  • ๐ŸŒ HTTP client and web request helpers
  • ๐Ÿ”’ AES and symmetric encryption utilities
  • ๐Ÿ”‘ Secure OTP generation using cryptographic RNG
  • ๐Ÿงฎ Number-to-word conversion (INR/USD/EUR support)
  • ๐Ÿ—๏ธ Lightweight, reusable, production-ready architecture
  • ๐ŸŽฏ Multi-target support for .NET Standard 2.0, .NET 8, and .NET 10

๐Ÿ“ฆ Installation

dotnet add package Ragom.Toolkit

or via Package Manager:

Install-Package Ragom.Toolkit

๐Ÿงฉ Namespaces

Ragom.Toolkit.Extensions
Ragom.Toolkit.Models
Ragom.Toolkit.Security
Ragom.Toolkit.Services
Ragom.Toolkit.Utilities
Ragom.Toolkit.Database

๐Ÿ”ง Extensions


๐Ÿ“… DateTimeExtensions

DateTime now = DateTimeExtensions.GetIndianDateTime();

var start = DateTimeExtensions.GetDateFromCollection("01/01/2025 - 10/01/2025");

DateTime? dt = "26052026".ToDateTimeFromDdMMyyyy();

๐Ÿงพ EnumExtensions

string description = Status.Active.ToDescription();

๐Ÿ“ FileExtensions

bool exists = FileExtensions.IsFileExist(@"C:\temp\file.txt");
bool deleted = FileExtensions.DeleteFile(@"C:\temp\file.txt");

๐ŸŽจ FormatExtensions

"9876543210".ToPhoneFormat();
"hello world".ToTitleCase();
"12345".ToCurrencyStyle();
"1000000".ToNumberFormat();
"1234567812345678".CardNumberMaskedWithStar(4, 4);

๐Ÿ”ค StringExtensions

"abc@123#".RemoveSpecialCharacters();
"abc@123#".RemoveSpecialCharacters(new char[] { '@' });

๐ŸŒ UrlExtensions

string url = "https://example.com/path".ToUrlFormat();

โœ… ValidationExtensions

"123.45".IsNumeric();
"test@example.com".IsValidEmail();

๐Ÿ”„ ConversionExtensions

Safe conversion helpers for:

  • int / long / float / double / decimal
  • bool
  • DateTime
  • TimeSpan
  • Guid
  • Enum
  • Nullable conversions
  • Object-to-type conversions

Supports:

  • DBNull handling
  • Invariant culture parsing
  • Safe fallback defaults
  • Nullable return types

๐Ÿ”ข Integer Conversion

"100".ToInt();
"100".ToIntNull();

object value = "200";
value.ToInt();

๐Ÿ”ข Long Conversion

"999999".ToLong();
"999999".ToLongNull();

๐Ÿ”ข Decimal / Double / Float

"12.50".ToDouble();
"99.95".ToDecimal();
"45.7".ToFloat();

Nullable:

"".ToDoubleNull();
"".ToDecimalNull();
"".ToFloatNull();

โœ… Boolean Conversion

Supports:

true/false
1/0
yes/no
y/n
on/off

Example:

"yes".ToBool();
"1".ToBool();

object value = "off";
value.ToBool();

Nullable:

"maybe".ToBoolNull();

๐Ÿ“… DateTime Conversion

Supported formats:

dd/MM/yyyy
dd-MM-yyyy
yyyy-MM-dd
yyyy-MM-dd HH:mm:ss
yyyy-MM-ddTHH:mm:ss

Example:

"26/05/2026".ToDateTime();

object value = "2026-05-26";
value.ToDateTime();

Nullable:

"invalid".ToDateTimeNull();

โฑ๏ธ TimeSpan Conversion

"02:30".ToNullTimeSpan();

object value = "01:15:00";
value.ToNullTimeSpan();

๐Ÿ”ค String Conversion

object data = "Hello World";
data.ToStr();

object nullData = null;
nullData.ToStr("N/A");

object spacedData = "  Clean Me  ";
spacedData.ToTrimmedStr();

string emptyStr = "   ";
emptyStr.ToNullIfEmpty();

๐Ÿ†” Guid Conversion

"d85b1407-351d-4694-9392-03acc5870eb1".ToGuid();

object value = Guid.NewGuid();
value.ToGuid();

Nullable:

"invalid".ToGuidNull();

๐Ÿงฉ Enum Conversion

"Admin".ToEnum<UserRole>();

"Active".ToEnum(Status.Pending);

object dbValue = "2";
dbValue.ToEnum(Status.Active);

Nullable:

object value = "Pending";
value.ToEnumNull<Status>();

โšก Features

  • Safe parsing without exceptions
  • Handles null and DBNull values
  • Culture-invariant parsing
  • Nullable conversion support
  • Enum parsing support
  • Production-ready extension methods

๐Ÿงฉ Models

DbCondition

Used for dynamic SQL query building.

var condition = new DbCondition("Age", 25, ">");

Supported operators:

=, !=, <>, >, <, >=, <=, LIKE

DbData

Used for INSERT/UPDATE parameter mapping.

var data = new DbData("Name", "John");

๐Ÿ” Security

CryptoUtility

Supports multiple symmetric encryption algorithms:

  • DES
  • RC2
  • Rijndael (Recommended)
  • TripleDES
string enc = CryptoUtility.Encrypt("HelloWorld", "MyPass");
string dec = CryptoUtility.Decrypt(enc, "MyPass");

EncryptionService (AES)

string enc = EncryptionService.Encrypt("Hello");
string dec = EncryptionService.Decrypt(enc);

๐ŸŒ HTTP Services

HttpServices

string result = await HttpServices.FetchFromWebAsync("https://api.example.com");

Add query parameters:

var url = HttpServices.AppendToQueryString(
    "https://example.com/search",
    new NameValueCollection { { "q", "dotnet" } }
);

๐Ÿ—„๏ธ Database Utilities

DbHelper

A lightweight ADO.NET helper for SQL Server with support for:

  • Generic object mapping
  • INSERT / UPDATE / UPSERT
  • ExecuteScalar
  • ExecuteDataTable
  • ExecuteDataSet
  • Parameterized queries
  • SQL transaction support
  • Safe SQL validation

โœ” Execute Generic List

var users = DbHelper.ExecuteGenericList<User>(
    connectionString,
    "SELECT * FROM Users",
    CommandType.Text
);

โœ” Insert Data

var data = new List<DbData>
{
    new DbData("Name", "John"),
    new DbData("Age", 25)
};

long id = DbHelper.Insert(
    connectionString,
    "Users",
    data
);

โœ” Update Data

var data = new List<DbData>
{
    new DbData("Name", "Updated User")
};

var conditions = new List<DbCondition>
{
    new DbCondition("Id", 1, "=")
};

DbHelper.Update(
    connectionString,
    "Users",
    data,
    conditions
);

โœ” Insert or Update (Upsert)

DbHelper.InsertUpdate(
    connectionString,
    "Users",
    data,
    conditions
);

โœ” Execute Raw Query

DbHelper.ExecuteQuery(
    connectionString,
    "DELETE FROM Logs",
    CommandType.Text
);

โœ” Execute DataTable

DataTable dt = DbHelper.ExecuteDataTable(
    connectionString,
    "SELECT * FROM Users",
    CommandType.Text
);

โœ” Execute DataSet

DataSet ds = DbHelper.ExecuteDataSet(
    connectionString,
    "sp_GetDashboard",
    CommandType.StoredProcedure
);

โœ” Execute Scalar

string count = DbHelper.ExecuteScalarData(
    connectionString,
    "SELECT COUNT(*) FROM Users",
    CommandType.Text
);

โœ” Unique Validation

bool exists = DbHelper.IsUnique(
    connectionString,
    "Users",
    "Email",
    "test@example.com"
);

๐Ÿ” Database Security Features

  • SQL Injection Protection
  • Parameterized Queries
  • Table & Column Validation
  • Safe SQL Operators
  • Transaction Support
  • Reflection-based Mapping Cache
  • DBNull Handling
  • Nullable Type Support

๐Ÿงฎ Utilities

NumericToWord

Convert numbers into words (supports INR, USD, EUR).

string r1 = NumericToWord.ConvertNumericToWord("123.50");
string r2 = NumericToWord.ConvertNumericToWord("1000", CurrencyType.USD);

Currency Types

INR โ†’ Rupees Only
USD โ†’ Dollars Only
EUR โ†’ Euros Only

OtpGenerator

Secure OTP generation using cryptographic RNG.

string otp = OtpGenerator.GetOTP(6);

โšก Why Ragom.Toolkit?

  • Lightweight and dependency-free
  • Production-ready utilities
  • Clean extension-based design
  • Secure encryption & OTP generation
  • Reusable across enterprise applications

๐Ÿ“Œ License

Internal / Project use (update as required)


dotnet, utilities, extensions, encryption, otp, helper, toolkit, ragom, validation, format, http

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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.1 114 6/12/2026
1.0.0 112 5/27/2026

- Added safe String Extension Methods (.ToStr(), .ToTrimmedStr(), .ToNullIfEmpty()).
- Handle null and DBNull.Value safely for objects without throwing NullReferenceException.
- Added support for custom default values when converting null objects to string.
- Prevent unnecessary string modification and optimized for database insertions.