OrmTxcSql.DB2
2.0.8
dotnet add package OrmTxcSql.DB2 --version 2.0.8
NuGet\Install-Package OrmTxcSql.DB2 -Version 2.0.8
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="OrmTxcSql.DB2" Version="2.0.8" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OrmTxcSql.DB2" Version="2.0.8" />
<PackageReference Include="OrmTxcSql.DB2" />
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 OrmTxcSql.DB2 --version 2.0.8
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: OrmTxcSql.DB2, 2.0.8"
#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 OrmTxcSql.DB2@2.0.8
#: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=OrmTxcSql.DB2&version=2.0.8
#tool nuget:?package=OrmTxcSql.DB2&version=2.0.8
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
OrmTxcSql
O/R mapping, Transaction control, SQL
Overview
OrmTxcSql is a lightweight O/R mapping, transaction control, and SQL execution library for .NET applications.
Packages
- OrmTxcSql - Core library
- OrmTxcSql.Npgsql - PostgreSQL support
- OrmTxcSql.SqlClient - SQL Server support
- OrmTxcSql.DB2 - IBM DB2/iSeries support
Supported Frameworks
- .NET 8.0
- .NET 6.0
- .NET Framework 4.8
- .NET Framework 4.6.2
Installation
# PostgreSQL
dotnet add package OrmTxcSql.Npgsql
# SQL Server
dotnet add package OrmTxcSql.SqlClient
# IBM DB2/iSeries
dotnet add package OrmTxcSql.DB2
Basic Usage
Entity Definition
[Table("products")]
public class ProductEntity : BaseNpgsqlEntity
{
[Column("product_code"), PrimaryKey]
public string ProductCode { get; set; }
[Column("description")]
public string Description { get; set; }
}
DAO Implementation
public class ProductDao : BaseNpgsqlDao<ProductEntity>
{
public override ProductEntity[] Select(ProductEntity entity)
{
// table name
string tableName = EntityUtils.GetTableName<ProductEntity>();
// column names
string[] columnNames = EntityUtils.GetColumnAttributes<ProductEntity>()
.Select(prop => new
{
PropertyInfo = prop,
ColumnName = prop.GetCustomAttribute<ColumnAttribute>(false)?.ColumnName ?? String.Empty
})
.Where(src => !String.IsNullOrEmpty(src.ColumnName))
.Select(src => src.ColumnName)
.ToArray();
//
// sql
var builder = new StringBuilder();
builder.Append(" select");
builder.Append(String.Join(",", columnNames.Select(columnName => String.Format(" x.{0}", columnName))));
builder.Append(this.GetCommonFieldForSelect("x"));
builder.Append(" from ").Append(tableName).Append(" as x");
builder.Append(" where");
builder.Append(" x.product_code like @parameter_product_code_prefix || '%'");
builder.Append(this.GetCommonFieldForSelectCondition("x", true));
//
// set up command text
NpgsqlCommand command = this.Command;
command.CommandText = builder.ToString();
// set up command parameters
NpgsqlServer.AddParameterOrReplace(command, "@parameter_product_code_prefix", NpgsqlDbType.Varchar, entity.ProductCode);
//
// prepara command
command.Prepare();
//
// return result
DataTable dt = this.GetDataTable(command);
ProductEntity[] result = dt.AsEnumerable<ProductEntity>().ToArray();
return result;
}
}
Data Source Configuration
// PostgreSQL
var dataSource = new NpgsqlDataSource("Host=localhost;Database=mydb;Username=user;Password=pass");
// SQL Server
var dataSource = new SqlClientDataSource("Server=localhost;Database=mydb;Integrated Security=true");
Key Features
- Simple O/R mapping
- Automatic transaction management
- Parameterized query support
- Multiple database support
- Lightweight and high performance
License
MIT License
Repository
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.6.2
- NLog (>= 5.5.1)
- OrmTxcSql (>= 2.0.8)
- System.Threading.Tasks.Extensions (>= 4.6.3)
-
.NETFramework 4.8
- NLog (>= 5.5.1)
- OrmTxcSql (>= 2.0.8)
- System.Threading.Tasks.Extensions (>= 4.6.3)
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.8 | 132 | 9/2/2025 |
2.0.7 | 151 | 8/30/2025 |
2.0.6 | 81 | 7/5/2025 |
2.0.5 | 154 | 12/27/2024 |
2.0.3 | 157 | 10/17/2024 |
2.0.1 | 170 | 5/31/2024 |
2.0.0.1 | 249 | 6/19/2023 |
2.0.0 | 223 | 6/12/2023 |
1.2.0.1 | 368 | 12/21/2022 |
1.2.0 | 381 | 11/16/2022 |
1.1.1 | 473 | 8/24/2022 |
1.1.0 | 479 | 7/22/2022 |
1.0.10 | 513 | 6/10/2022 |
1.0.8 | 515 | 3/29/2022 |
1.0.7 | 453 | 11/3/2021 |
1.0.6 | 412 | 11/2/2021 |
1.0.5.1 | 459 | 10/28/2021 |
1.0.5 | 417 | 10/25/2021 |
1.0.4 | 383 | 10/15/2021 |
1.0.3 | 402 | 10/12/2021 |
1.0.1 | 398 | 10/12/2021 |
1.0.0 | 454 | 9/22/2021 |