OrmTxcSql.Npgsql 2.0.8

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

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

https://github.com/tanoue13/OrmTxcSql

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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 was computed.  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 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.

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 0 9/2/2025
2.0.7 141 8/30/2025
2.0.6 89 7/5/2025
2.0.5 143 12/27/2024
2.0.3 144 10/17/2024
2.0.2 186 9/16/2024
2.0.1.1 152 9/13/2024
2.0.1 158 5/31/2024
2.0.0.1 240 6/19/2023
2.0.0 209 6/12/2023
1.2.0 392 11/16/2022
1.1.1 470 8/24/2022
1.1.0 469 7/22/2022
1.0.10.1 487 6/17/2022
1.0.10 490 6/10/2022
1.0.8 521 3/29/2022
1.0.7 442 11/3/2021
1.0.6 425 11/2/2021
1.0.5 424 10/25/2021
1.0.4 386 10/15/2021
1.0.3 385 10/12/2021
1.0.1 391 10/12/2021
1.0.0 446 9/22/2021