SQLProcedureDAOCore 3.0.1
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package SQLProcedureDAOCore --version 3.0.1
NuGet\Install-Package SQLProcedureDAOCore -Version 3.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="SQLProcedureDAOCore" Version="3.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SQLProcedureDAOCore --version 3.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SQLProcedureDAOCore, 3.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 SQLProcedureDAOCore as a Cake Addin #addin nuget:?package=SQLProcedureDAOCore&version=3.0.1 // Install SQLProcedureDAOCore as a Cake Tool #tool nuget:?package=SQLProcedureDAOCore&version=3.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
SQLProcedureDAO
SQL Data access object to execute SQL Stored Procedures.
Note : Support User Defined Tables
Installation
Use the NuGet Package Manager to install SQLProcedureDAO.
PM> Install-Package SQLProcedureDAOCore
Usage
1 - Create a class extends DAOContext
public class ProductDAODbContext: DAOContext
{
public ProductDAODbContext() : base("ConnectionString")
{
}
}
2 - Create an object for ProductDAODbContext
ProductDAODbContext daoContext = new ProductDAODbContext();
- Create a ProductModel
// product model
public class ProductModel {
public int Id {get; set;}
public string ProductName {get; set;}
public decimal Price{get; set;}
}
3 - Execute Insert/Update procedure
- First parameter ⇒ Procedure name
- Second parameter ⇒ Argument names as string array
- Third parameter ⇒ Values as object array
Argument array and values array order should match
int res = daoContext.ExecuteStoredProcedure("InsertProduct",
new string[]{"ProductName", "Price"},
new object[]{"Rice", 54.2});
4- Execute Select procedure by retrieving only first value of first row
- Return value as type parameter
int res = daoContext.ExecuteStoredProcedure<int>("GetSumOfProduct",
new string[]{"ProductId"},
new object[]{1});
//without parameters
bool isNewOrderArrived = daoContext.ExecuteStoredProcedure<bool>("IsNewOrderArrived");
//type parameter as ProductModel, (Get first row only)
ProductModel productModel = daoContext.ExecuteStoredProcedure<ProductModel>("GetAllProducts");
//type parameter as List<ProductModel>
List<ProductModel> productModel = daoContext.ExecuteStoredProcedureAsList<ProductModel>("GetAllProducts");
4- Execute Procedure by User Defined Table (UDT)
List<ProductModel> productList = new List<ProductModel>()
{
new ProductModel{ProductName = "Cashew nut", Price = 450},
new ProductModel{ProductName = "Chilly Powder", Price = 40},
};
//specify UDT parameter name inside 3rd parameter as string[], should incluede in parameter names array
//return rows affected
int res = program.ExecuteStoredProcedureWithUDT(
procedureName: "InsertProducts",
parameterNames: new string[] { "CreatedAt", "IsActive", "Item" },
udtParameterNames: new string[] { "Item" },
values: new object[] { DateTime.Now, 1, productList });
/* return parameter as first column value from first row(If insert procedure end query is select statement)
or you can use custom models as return according to your procedure select statement */
int id = program.ExecuteStoredProcedureWithUDT<int>(
procedureName: "InsertProductASUDT",
parameterNames: new string[] { "CreatedAt", "IsActive", "Item" },
udtParameterNames: new string[] { "Item" },
values: new object[] { DateTime.Now, 1, productList });
License
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 | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | 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.1
- System.Configuration.ConfigurationManager (>= 7.0.0)
- System.Data.SqlClient (>= 4.8.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.