LiteX.DbHelper.Core 2.0.0

This library contains useful database utilitity classes, functions and extension methods.
     ADO.NET wrapper specifically develop to help make life easy working with relational databases like SQLServer, MySql, PostgreSql, MariaDB, Oracle and stored procedures for .NET and .NET Core applications.
    
     LiteXDbHelper is simple and tiny yet powerful and very high-performance library to working with ADO.NET.

Install-Package LiteX.DbHelper.Core -Version 2.0.0
dotnet add package LiteX.DbHelper.Core --version 2.0.0
<PackageReference Include="LiteX.DbHelper.Core" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add LiteX.DbHelper.Core --version 2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Features

Basic features
  • ExecuteNonQuery
  • ExecuteScalar
  • GetDataTable
  • GetDataSet
  • ExecuteReder
  • CreateParameters (for each providers)
Advanced features
  • ExecuteScalar<>
  • GetSingle<T>
  • GetList<T>
  • GetArray<T>
  • GetDictionary<TKey, TValue>

Instantiate the DBHelper:

...
// just use the connection string name
IDBHelper dbHelper = new SqlHelper("MyCN");
// use different provider class based on your database.

Basic ADO.NET methods:

// Create parameters
var paramResultOut = DbHelper.CreateOutParameter("@Result", SqlDbType.NVarChar, 100);
var paramIsActive = DbHelper.CreateParameter("@IsActive", isActive);
var paramId = DbHelper.CreateParameter("@Id", id);

  
// ExecuteNonQuery
// Stored procedure
var count = _dbHelper.ExecuteNonQuery("DeleteCountry", paramIsActive, paramResultOut);
// OR
// Raw sql commnad
var count = _dbHelper.ExecuteNonQuery("DELETE FROM [dbo].[Country] WHERE Id = @Id", CommandType.Text, paramIsActive);


// ExecuteScalar - returning a object type scalar value 
var name = _dbHelper.ExecuteScalar("SELECT Name FROM COUNTRY");


// DataReader
// Stored procedure
var dataReader = _dbHelper.ExecuteReder("GetCountries", paramIsActive, paramResultOut);
// OR
// Raw sql commnad
var dataReader = _dbHelper.ExecuteReder("SELECT * FROM Country WHERE IsActive = @IsActive", CommandType.Text, paramIsActive);


// DataTable
// Stored procedure
var dataTable = _dbHelper.GetDataTable("GetCountries", paramIsActive, paramResultOut);
// OR
// Raw sql commnad
var dataTable = _dbHelper.GetDataTable("SELECT * FROM Country WHERE IsActive = @IsActive", CommandType.Text, paramIsActive);


// DataSet
// Stored procedure
var dataSet = _dbHelper.GetDataSet("GetCountriesAndStates", paramIsActive, paramResultOut);

Features

Basic features
  • ExecuteNonQuery
  • ExecuteScalar
  • GetDataTable
  • GetDataSet
  • ExecuteReder
  • CreateParameters (for each providers)
Advanced features
  • ExecuteScalar<>
  • GetSingle<T>
  • GetList<T>
  • GetArray<T>
  • GetDictionary<TKey, TValue>

Instantiate the DBHelper:

...
// just use the connection string name
IDBHelper dbHelper = new SqlHelper("MyCN");
// use different provider class based on your database.

Basic ADO.NET methods:

// Create parameters
var paramResultOut = DbHelper.CreateOutParameter("@Result", SqlDbType.NVarChar, 100);
var paramIsActive = DbHelper.CreateParameter("@IsActive", isActive);
var paramId = DbHelper.CreateParameter("@Id", id);

  
// ExecuteNonQuery
// Stored procedure
var count = _dbHelper.ExecuteNonQuery("DeleteCountry", paramIsActive, paramResultOut);
// OR
// Raw sql commnad
var count = _dbHelper.ExecuteNonQuery("DELETE FROM [dbo].[Country] WHERE Id = @Id", CommandType.Text, paramIsActive);


// ExecuteScalar - returning a object type scalar value 
var name = _dbHelper.ExecuteScalar("SELECT Name FROM COUNTRY");


// DataReader
// Stored procedure
var dataReader = _dbHelper.ExecuteReder("GetCountries", paramIsActive, paramResultOut);
// OR
// Raw sql commnad
var dataReader = _dbHelper.ExecuteReder("SELECT * FROM Country WHERE IsActive = @IsActive", CommandType.Text, paramIsActive);


// DataTable
// Stored procedure
var dataTable = _dbHelper.GetDataTable("GetCountries", paramIsActive, paramResultOut);
// OR
// Raw sql commnad
var dataTable = _dbHelper.GetDataTable("SELECT * FROM Country WHERE IsActive = @IsActive", CommandType.Text, paramIsActive);


// DataSet
// Stored procedure
var dataSet = _dbHelper.GetDataSet("GetCountriesAndStates", paramIsActive, paramResultOut);

Release Notes

Advanced features (Strongly type result) - ExecuteScalar, GetSingle, GetList, GetArray, GetDictionary
     DBConvert methods, DataReader, DataTable and DataTable extensions
     1.0.0 - Basic featured - ExecuteNonQuery, ExecuteScalar, GetDataTable, GetDataSet, ExecuteReder, CreateParameter
     Coming soon - Async methods support
     Comimg soon - OUT parameter support in stored procedure
     Coming soon - Ping (useful in health check and load balancing)
     Coming soon - Pagination at DB server side
     Coming soon - Batch execution

  • .NETStandard 2.0

    • No dependencies.

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
2.0.0 47 9/19/2019
1.0.0 325 6/19/2019