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

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.

NuGet .NET 8 | 9 | 10

📖 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);
// 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.Core
  • Microsoft.AspNetCore.App (framework reference)
  • Microsoft.Extensions.Configuration
  • Microsoft.Extensions.Configuration.Binder

License

MIT — Copyright © 2026 opentail.net

Product 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.

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
2.0.4.2 41 7/7/2026
2.0.4.1 40 7/7/2026
2.0.0 120 4/10/2026