Transformations.Web
2.0.4.2
dotnet add package Transformations.Web --version 2.0.4.2
NuGet\Install-Package Transformations.Web -Version 2.0.4.2
<PackageReference Include="Transformations.Web" Version="2.0.4.2" />
<PackageVersion Include="Transformations.Web" Version="2.0.4.2" />
<PackageReference Include="Transformations.Web" />
paket add Transformations.Web --version 2.0.4.2
#r "nuget: Transformations.Web, 2.0.4.2"
#:package Transformations.Web@2.0.4.2
#addin nuget:?package=Transformations.Web&version=2.0.4.2
#tool nuget:?package=Transformations.Web&version=2.0.4.2
Transformations.Web
Typed ASP.NET Core helpers for IConfiguration, session, cookies, query strings, HTTP responses, and MVC dropdowns — eliminating repetitive untyped boilerplate in controllers and middleware.
📖 Overview
Transformations.Web provides typed, one-liner extensions for the ASP.NET Core surfaces you touch in every controller and middleware: IConfiguration, session, cookies, query strings, HTTP responses, and MVC dropdowns.
🚀 Why Transformations.Web?
ASP.NET Core's native APIs for configuration, session, and cookies all deal in untyped strings. Every controller ends up with the same parse-check-fallback boilerplate repeated across dozens of methods. These extensions collapse that pattern into a single typed call — GetValue<T>(key, fallback) — and bring the same discipline to query strings, cookie management, and SelectList construction.
📦 Install
<PackageReference Include="Transformations.Web" Version="2.0.4.2" />
💡 What's Included
Typed IConfiguration Access
// Read with explicit type and fallback
int limit = ConfigurationHelper.GetValue<int>(config, "Security:RateLimit", defaultValue: 100);
// Read as string with fallback
string dsn = ConfigurationHelper.GetSetting(config, "Sentry:Dsn", defaultValue: string.Empty);
// Connection string shortcut
string cs = ConfigurationHelper.GetConnectionString(config, "DefaultConnection");
// Existence check
bool hasKey = ConfigurationHelper.ContainsKey(config, "FeatureFlags:NewDashboard");
Session State (Typed)
Session values are serialized to JSON and deserialized on read, so any serializable type works:
// Store
SessionHelper.SetValue(httpContext, "cart", cartObject);
// Retrieve with fallback
var cart = SessionHelper.GetValue<ShoppingCart>(httpContext, "cart");
// Check existence
bool hasCart = SessionHelper.Exists(httpContext, "cart");
// Clear a single key or the whole session
SessionHelper.Remove(httpContext, "cart");
SessionHelper.Clear(httpContext);
Query String Parsing
// Typed read with fallback
int page = QueryStringHelper.TryGetQuery<int>(httpContext, "page", defaultValue: 1);
// Presence check
bool hasFilter = QueryStringHelper.HasValue(httpContext.Request.Query, "filter");
// Get all as dictionary
var all = QueryStringHelper.GetAllQueryStrings(httpContext);
Cookie Management
// ICookieHelper is DI-registered; inject it into your controller
string token = _cookies.Get(httpContext, "auth_token");
_cookies.Set(httpContext, "pref", value, new CookieOptions { HttpOnly = true });
_cookies.Delete(httpContext, "auth_token");
HTTP Response Shortcuts
WebHelper.Redirect(httpContext, "/dashboard");
WebHelper.SetFileNotFound(httpContext);
WebHelper.SetInternalServerError(httpContext);
WebHelper.SetStatus(httpContext, 429);
// Async redirect with optional window target
await ResponseHelper.RedirectAsync(httpContext, "/login", target: "_top");
MVC SelectList Helpers
Convert a DataTable directly to a List<SelectListItem> for MVC/Razor dropdowns:
// Basic — specify the text column and value column
var items = dataTable.ToSelectList(nameColumn: "RoleName", valueColumn: "RoleId");
// With pre-selected item (matches by value or by name, case-insensitive)
var items = dataTable.ToSelectList("RoleName", "RoleId",
selectedValue: currentRoleId.ToString());
🛠 API Reference
| Class | Purpose | Key Members |
|---|---|---|
ConfigurationHelper |
IConfiguration access |
GetSetting, GetValue<T>, GetConnectionString, TryGetSetting, ContainsKey, GetManualSetting |
QueryStringHelper |
Query string parsing | TryGetQuery<T>, HasValue, GetAllQueryStrings, ParseQueryString |
SessionHelper |
Typed session state | GetValue<T>, SetValue<T>, Exists, GetAllStrings, Remove, Clear |
CookieHelper |
Cookie management | Get, Set, Delete via ICookieHelper interface |
WebHelper |
HTTP response control | Redirect, Reload, SetFileNotFound, SetInternalServerError, SetStatus |
ResponseHelper |
Async response helpers | RedirectAsync with optional window target |
SelectListExtensions |
DataTable → dropdown | ToSelectList(nameColumn, valueColumn, selectedValue?, selectedName?) |
📦 Dependencies
Transformations.CoreMicrosoft.AspNetCore.App(framework reference)Microsoft.Extensions.ConfigurationMicrosoft.Extensions.Configuration.Binder
License
MIT — Copyright © 2026 opentail.net
| 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. |
-
net10.0
- Transformations.Core (>= 2.0.4.2)
-
net8.0
- Microsoft.Extensions.Configuration (>= 10.0.7)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.7)
- Transformations.Core (>= 2.0.4.2)
-
net9.0
- Microsoft.Extensions.Configuration (>= 10.0.7)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.7)
- Transformations.Core (>= 2.0.4.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.