Ragom.Toolkit
1.0.1
dotnet add package Ragom.Toolkit --version 1.0.1
NuGet\Install-Package Ragom.Toolkit -Version 1.0.1
<PackageReference Include="Ragom.Toolkit" Version="1.0.1" />
<PackageVersion Include="Ragom.Toolkit" Version="1.0.1" />
<PackageReference Include="Ragom.Toolkit" />
paket add Ragom.Toolkit --version 1.0.1
#r "nuget: Ragom.Toolkit, 1.0.1"
#:package Ragom.Toolkit@1.0.1
#addin nuget:?package=Ragom.Toolkit&version=1.0.1
#tool nuget:?package=Ragom.Toolkit&version=1.0.1
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)
๐ฆ NuGet Tags (Recommended)
dotnet, utilities, extensions, encryption, otp, helper, toolkit, ragom, validation, format, http
| Product | Versions 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. |
-
.NETStandard 2.0
- Microsoft.Data.SqlClient (>= 7.0.1)
-
net10.0
- Microsoft.Data.SqlClient (>= 7.0.1)
-
net8.0
- Microsoft.Data.SqlClient (>= 7.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
- 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.