TStack.ADO
1.0.1
dotnet add package TStack.ADO --version 1.0.1
NuGet\Install-Package TStack.ADO -Version 1.0.1
<PackageReference Include="TStack.ADO" Version="1.0.1" />
paket add TStack.ADO --version 1.0.1
#r "nuget: TStack.ADO, 1.0.1"
// Install TStack.ADO as a Cake Addin
#addin nuget:?package=TStack.ADO&version=1.0.1
// Install TStack.ADO as a Cake Tool
#tool nuget:?package=TStack.ADO&version=1.0.1
Overview
The purpose of this library is the CRUD operations on the mssql server and also to work with a clean architecture. This library was developed with .NET standard.
Installation
Package Manager
Install-Package TStack.ADO -Version 1.0.1
.NET CLI
dotnet add package TStack.ADO --version 1.0.1
PackageReference
<PackageReference Include="TStack.ADO" Version="1.0.1" />
Paket CLI
paket add TStack.ADO --version 1.0.1
Usage
Before usage test project create manually database table like on picture
Step One
Inherit the ADOConnection class to the new class you are creating and set up the database connection.
public class TestConnection : ADOConnection
{
public TestConnection() : base(@"Server=.\SQLEXPRESS;Database=TESTDB;Trusted_Connection=True;")
{
}
}
Step Two
ADOManager is an abstract class, so it must be inherited to your new class, in which case all methods can be used
public class SQLManager : ADOManager
{
public SQLManager(TestConnection connection) : base(connection)
{
}
}
That's it, ready to use.
Library Fundamentals
For use methods first learn what is parameters and features, lets look.
Query
This parameter is the reference type string, if the entered query is stored procedure, the CommandType parameter should be selected as "StoredProcedure", otherwise "Text"
CommandType
This parameter is the reference type enum and have two choice
- Text
- StoredProcedure
Parameter
This parameter is reference type List of Parameter class and for usage has two parameter "key" (string,not nullable), "value" (object, not nullable) Example Usage :
List<Parameter> parameters = new List<Parameter>();
parameters.Add("Name", "Ferhat");
**Note 😗* The @ character is not required in the entered key parameter. No problem if entered.
parameters.Add("Name", "Ferhat"); Allowed
parameters.Add("@Name", "Ferhat"); Allowed
Methods
ExecuteScalar
This function returns a generic variable type, the typed query contains a single row and must contain a single column.
int response = _adomanager.ExecuteScalar<int>("SELECT count(*) from companies",CommandType.Text,null);
Execute
This function has no return type. Runs a typed query.
_adomanager.Execute("TRUNCATE TABLE companies",CommandType.Text,null);
GetDataTable
This function returns datatable, Runs a typed query, but must contains single query.
DataTable datatable = _adomanager.GetDataTable("SELECT * FROM companies",CommandType.Text,null);
GetDataSet
This function returns dataset, Runs a typed queries, contains can multiple queries.
DataSet dataset = _adomanager.GetDataTable(@"
SELECT * FROM companies;
SELECT * FROM employees;
",CommandType.Text,null);
Author
Ferhat CandaÅŸ - Software Developer
- Mail : candasferhat61@gmail.com
- LinkedIn : https://www.linkedin.com/in/ferhatcandas
Product | Versions 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. |
-
.NETStandard 2.0
- System.Data.SqlClient (>= 4.6.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Execute<T> method excluded.