ADO.DataAccessHelper 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package ADO.DataAccessHelper --version 1.0.1
NuGet\Install-Package ADO.DataAccessHelper -Version 1.0.1
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="ADO.DataAccessHelper" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ADO.DataAccessHelper --version 1.0.1
#r "nuget: ADO.DataAccessHelper, 1.0.1"
#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.
// Install ADO.DataAccessHelper as a Cake Addin
#addin nuget:?package=ADO.DataAccessHelper&version=1.0.1

// Install ADO.DataAccessHelper as a Cake Tool
#tool nuget:?package=ADO.DataAccessHelper&version=1.0.1

ADO.DataAccessHelper


ADO.DataAccessHelper is .net standard 2.0 class library, lite, simple, and more than one database connections from different technologies made possible with ADO.Net DbProviderFactory.

Few DbProviderFactories

MS SQL      : SqlClientFactory
MySql       : MySqlClientFactory
Oracle      : OracleClientFactory 
PostgreSql  : NpgsqlFactory
....        : ....

Provided features

  • Helper methods eliminates ADO.net repetitive code for the given DbProvider
  • Works for .net Framework 4.6.1 and later.
  • Works for .net core 2.0 and later.

Example

ADO.DataAccessHelper factory repository to be set at start of the application, it’s an optional and connection can be provided as input parameter to helper method, see Connection Example.

DatabaseProvider<SqlClientFactory>.Set("Sql.Connection1", $"{SqlConnection1String}");
DatabaseProvider<SqlClientFactory>.Set("Sql.Connection2", $"{SqlConnection2String}");
DatabaseProvider<NpgsqlFactory>.Set("PostgreSql.Connection", $"{PostgreSqlConnectionString}");
DatabaseProvider<MySqlClientFactory>.Set("MySql.Connection", $"{MySqlConnectionString}");

Different ways to use set factories. DatabaseProvider<SqlClientFactory>.... // Use desired factory to connect database server, e.g. here SqlClientFactory is used.

How to use the preset factory. DataAccess<SqlClientFactory>.... // Use desired factory, e.g. SqlClientFactory is used to connect SQL Server Instance. Option#1

//Default connection is, first connection set for SqlClientFactory
DataSet dataSet = DataAccess<SqlClientFactory>.ExecuteDataSetProcedure("SelectEmployee",
    new SqlParameter[] {
    new SqlParameter("@EmployeeId",7)
});

Option#2

//Explicit connection name to connect specific database instance with give DbProvider
DataSet dataSet = DataAccess<SqlClientFactory>.Get("Sql.Connection2")
    .ExecuteDataSetProcedure("SelectCustomer",
        new SqlParameter[] {
        new SqlParameter("@CustomerId",7)
     });

Option#3 In case there is one more database from PostgreSQL then NpgsqlFactory is used to perform data access.

//Default connection is  'PostgreSql.Connection', NpgsqlFactory has one connection
DataAccess<NpgsqlFactory>.ExecuteProcedure("DeleteAllLogs", 
      new NpgsqlParameter[] {
      new NpgsqlParameter("@UserId",7 )});

Connection Example Option#4

Provide connection string while making a call to helper method.

const string ConnectionString = @"Data Source=XYZ\SQLDEV;Initial Catalog=PlayGround;User Id=SA;Password=XXXXX";

//Make a call 
string name = DataAccess<SqlClientFactory>.ExecuteScalarQuery<string>
      ("Select Name from Employees Where EmployeeId = 7", ConnectionString); 

License

Copyright (C) 2019
(www.codefode.com) Hiten

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/ or https://www.gnu.org/licenses/agpl-3.0.html>.
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

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
1.1.2 1,017 2/3/2020
1.1.1 558 12/20/2019
1.0.1 546 11/4/2019