Transformations.Data
2.0.4.2
dotnet add package Transformations.Data --version 2.0.4.2
NuGet\Install-Package Transformations.Data -Version 2.0.4.2
<PackageReference Include="Transformations.Data" Version="2.0.4.2" />
<PackageVersion Include="Transformations.Data" Version="2.0.4.2" />
<PackageReference Include="Transformations.Data" />
paket add Transformations.Data --version 2.0.4.2
#r "nuget: Transformations.Data, 2.0.4.2"
#:package Transformations.Data@2.0.4.2
#addin nuget:?package=Transformations.Data&version=2.0.4.2
#tool nuget:?package=Transformations.Data&version=2.0.4.2
Transformations.Data
Typed, null-safe extensions for ADO.NET DataRow, IDataReader, and SqlParameter — eliminating boilerplate DBNull checks and manual parameter wiring in data-access layers.
📖 Overview
Transformations.Data wraps the harsh edges of raw ADO.NET — DataRow, IDataReader, and SqlParameter — with typed, null-safe extension methods. It's the layer that makes high-performance ETL pipelines, reporting queries, and bulk operations clean to write.
🚀 Why Transformations.Data?
Despite the rise of ORMs, enterprise architectures regularly drop down to raw ADO.NET for bulk inserts, stored-procedure calls, and reporting pipelines. The problem is that DBNull.Value, boxing cast errors, and manual SqlParameter wiring pollute every data-access method. Transformations.Data introduces defensive typed getters and a fluent parameter API that eliminates this boilerplate entirely.
📦 Install
<PackageReference Include="Transformations.Data" Version="2.0.4.2" />
💡 What's Included
Safe DataRow Extraction
Eliminates DBNull.Value checks, boxing cast errors, and index-out-of-range exceptions. A unified generic getter accepts an explicit type and fallback.
foreach (DataRow row in dataTable.Rows)
{
int age = row.GetValue<int>("Age", fallback: 0);
string name = row.GetValue<string>("FullName", fallback: "Unknown");
Guid id = row.GetValue<Guid>("TenantId");
}
// Check column/row presence before reading
if (row.HasColumns("LastLogin") && !row.IsNumericValue("Status"))
Process(row);
IDataReader Extensions
Type-safe column extraction directly on streaming readers:
using var reader = await command.ExecuteReaderAsync();
while (await reader.ReadAsync())
{
Guid tenantId = reader.GetValue<Guid>("TenantId");
string email = reader.GetValue<string>("Email", fallback: string.Empty);
}
SqlParameter Construction
Fluent extension methods for building SqlParameter instances from any .NET type, with explicit SqlDbType control. Covers all primitives, nullable variants, DataTable (TVP), XDocument, and byte[].
// Value → SqlParameter
SqlParameter p1 = userId.ToSqlParameter("@UserId");
SqlParameter p2 = createdAt.ToSqlParameter("@CreatedAt", SqlDbType.DateTime2);
SqlParameter p3 = xmlDoc.ToSqlParameter("@Payload");
// Build a parameter list fluently
var cmd = new SqlCommand("EXEC sp_UpsertUser", conn);
cmd.Parameters.Add(userId, "@UserId", SqlDbType.Int);
cmd.Parameters.Add(email, "@Email", 50, SqlDbType.VarChar);
cmd.Parameters.Add(tvpTable, "@UserList", typeName: "dbo.UserTableType");
// Chain setters on an existing parameter
existingParam
.SetDirection(ParameterDirection.Output)
.SetSqlDbType(SqlDbType.Int)
.SetSize(4);
CSV Generation from Collections and DataTables
// From IEnumerable<T>
string csv = people.ToCsv();
string tsv = people.ToCsv(separator: '\t', qualifier: '"');
// From DataTable
string csv = dataTable.ToCsv();
🛠 API Reference
| Class | Purpose | Key Members |
|---|---|---|
DataRowConverter |
Safe DataRow access |
GetValue<T>, TryGetValue<T>, GetStringValue, HasRows, HasColumns, IsNumericValue |
DataReaderHelper |
IDataReader typed access |
GetValue<T> with column name and optional fallback |
SqlHelper |
SqlParameter builders |
ToSqlParameter (20+ type overloads), ToSqlParameterList, ToParameterArray, SetDirection, SetSqlDbType, SetValue, SetSize, ValidateParameters |
CsvHelper |
CSV generation | ToCsv — IEnumerable<T> or DataTable, configurable separator and text qualifier |
📦 Dependencies
Transformations.CoreMicrosoft.Data.SqlClient
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
- Microsoft.Data.SqlClient (>= 7.0.0)
- Transformations.Core (>= 2.0.4.2)
-
net8.0
- Microsoft.Data.SqlClient (>= 7.0.0)
- Transformations.Core (>= 2.0.4.2)
-
net9.0
- Microsoft.Data.SqlClient (>= 7.0.0)
- 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.