Skip to content

Repository files navigation

TagBites.DB

NugetLicense

TagBites.DB is a library that simplifies query execution in .NET applications. It efficiently manages database connections, executes queries, and handles transactions. The library supports multiple database providers, including PostgreSQL and SQLite.

This project is not recommended for general use as there are better solutions available. This library was specifically designed for a very complex ERP system where a single connection and transaction pass through multiple libraries and functions. It allows tracking the start and end of connections and transactions, and hooking into various events such as connection opened, connection closed, transaction beginning, transaction committed, and more.

Features

  • Database Abstraction: Provides a unified API for interacting with different database systems.
  • Connection Management: Efficiently manages database connections and transactions.
  • Cursor Management (PostgreSQL): Supports cursor-based data retrieval for large datasets.
  • Extensible: Easily extendable to support additional database providers.

Supported Database Providers

  • PostgreSQL (supports all API features)
  • SQLite
  • SqlServer

Installation

You can install the TagBites.DB packages via NuGet:

dotnet add package TagBites.DB
dotnet add package TagBites.DB.Postgres
dotnet add package TagBites.DB.Sqlite
dotnet add package TagBites.DB.SqlServer

Usage

  • Initialize the Database Provider
varprovider=newPgSqlLinkProvider("your_connection_string");
  • Execute Queries
using(varlink=provider.CreateLink()){varresult=link.Execute(SELECT*FROM your_table");foreach(varrowinresult){// ...}}
  • Execute Scalar
using(varlink=provider.CreateLink()){varvalue=link.ExecuteScalar<int>("SELECT 1");}
  • Batch execute
using(varlink=provider.CreateLink()){varresults=link.BatchExecute("SELECT 1; SELECT 2, 3");foreach(varresultinresults)foreach(varrowinresult){// ...}}
  • Delay Batch Execute
using(varlink=provider.CreateLink()){varr1=link.DelayedBatchExecute("SELECT 1");// ...varr2=link.DelayedBatchExecute("SELECT 2");// ..// First call to Result executes all delay queries at once.foreach(varresultinr1.Result){// ...}}

About

Multi-provider .NET database library with connection, transaction and batch query management.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages