VTNET.Vitado
2.0.1
See the version list below for details.
dotnet add package VTNET.Vitado --version 2.0.1
NuGet\Install-Package VTNET.Vitado -Version 2.0.1
<PackageReference Include="VTNET.Vitado" Version="2.0.1" />
<PackageVersion Include="VTNET.Vitado" Version="2.0.1" />
<PackageReference Include="VTNET.Vitado" />
paket add VTNET.Vitado --version 2.0.1
#r "nuget: VTNET.Vitado, 2.0.1"
#:package VTNET.Vitado@2.0.1
#addin nuget:?package=VTNET.Vitado&version=2.0.1
#tool nuget:?package=VTNET.Vitado&version=2.0.1
ADO.NET Wrapper Library
Introduction
This library is designed to simplify ADO.NET interactions by wrapping around ADO.NET and using the SqlDataReader class to read data. It provides a set of methods for executing queries and stored procedures and mapping the results to objects, making database interactions in your .NET applications more straightforward and efficient.
Commands
The library offers a variety of commands to execute and interact with your database:
Query
Query: Execute a query and return the number of affected rows.Query<T>: Execute a query and return a list of mapped data.QueryAsync: Asynchronously execute a query and return the number of affected rows.QueryAsync<T>: Asynchronously execute a query and return a list of mapped data.QueryTable: Execute a query and return the result as a DataTable.QueryTableAsync: Asynchronously execute a query and return the result as a DataTable.QueryFirst<T>: Execute a query and return the first row as a mapped object.QueryFirstAsync<T>: Asynchronously execute a query and return the first row as a mapped object.QueryOne<T>: Execute a query and return the first cell of the first row as a mapped object.QueryOneAsync<T>: Asynchronously execute a query and return the first cell of the first row as a mapped object.
Stored Procedure
Stored: Execute a stored procedure and return the number of affected rows.Stored<T>: Execute a stored procedure and return a list of mapped data.StoredAsync: Asynchronously execute a stored procedure and return the number of affected rows.StoredAsync<T>: Asynchronously execute a stored procedure and return a list of mapped data.StoredTable: Execute a stored procedure and return the result as a DataTable.StoredTableAsync: Asynchronously execute a stored procedure and return the result as a DataTable.StoredFirst<T>: Execute a stored procedure and return the first row as a mapped object.StoredFirstAsync<T>: Asynchronously execute a stored procedure and return the first row as a mapped object.StoredOne<T>: Execute a stored procedure and return the first cell of the first row as a mapped object.StoredOneAsync<T>: Asynchronously execute a stored procedure and return the first cell of the first row as a mapped object.
Integration with ASP/Blazor
You can easily integrate this library into your ASP.NET or Blazor applications. To get started, add the following code to your Startup.cs or Program.cs:
builder.Services.AddVitado("Data Source=.;Initial Catalog=...;MultipleActiveResultSets=True;User Id=...;Password=...");
Make sure to replace the connection string with your specific database details.
How to Use
Query
Here are examples of how to use the library for querying:
// Query and map data
List<DBOrderTable> fbBanLeTam = await db.QueryAsync<DBOrderTable>("SELECT * FROM [dbo].[FB_BANLE_TAM]");
DBOrderTable fbBanLeTam = await db.QueryFirstAsync<DBOrderTable>("SELECT TOP 1 * FROM [dbo].[FB_BANLE_TAM]");
string name = await db.QueryOneAsync<string>("SELECT TOP 1 * FROM [dbo].[FB_BANLE_TAM]");
// Parameters
var inforUser = await db.QueryFirstAsync<DB_SYS_USER>(
query: "SELECT [UserName], [FullName], [Email], [PassWD], [UID], [Is_Employee], [Manv], [Must_Chg_Pwd] FROM [ERP_SOFTZ].[dbo].[SYS_USER] WHERE UID = @UID",
paramsIn: new(("@UID", 241))
);
Stored Procedure
For using stored procedures, follow these examples:
// Query and map data
List<DBOrderTable> fbBanLeTam = await db.StoredAsync<DBOrderTable>("[dbo].[SYS_ReportParams]");
DBOrderTable fbBanLeTam = await db.StoredFirstAsync<DBOrderTable>("[dbo].[SYS_ReportParams]");
// Parameters
var inforUser = await db.QueryFirstAsync<DB_SYS_USER>(
stored: "[dbo].[SYS_ReportParams]",
paramsIn: new(("@UID", 241))
);
// Parameters with Output
var dataStored1 = db.StoredTable("[dbo].[SYS_ReportParams]", new(("@UID", 241), ("CODE", "NV1001")), new(("@Name", ""), ("@TestOutParams", 0)));
// Execute stored procedures without regard to parameters
var vitParamsAuto = db.StoredParams("[dbo].[SYS_ReportParams]").ToVitParamsAuto();
var dataStored2 = db.StoredTable("[dbo].[SYS_ReportParams]", vitParamsAuto.Item1, vitParamsAuto.Item2);
Get Parameters Of Stored Procedure And Mapping Type
var vitParams = db.StoredParams("[dbo].[SYS_ReportParams]");
foreach (var item in vitParams)
{
var type = item.Type.GetTypeMap(); // mapping SqlDbType to Type
var defaultValue = type.GetDefaultValue(); // get default value of type
Console.WriteLine($"Type:{type}, ValueDefault:{defaultValue}");
}
You can now seamlessly work with your database using this ADO.NET wrapper library, saving time and effort in your .NET applications.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net7.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net7.0
- Microsoft.Extensions.Configuration (>= 7.0.0)
- Microsoft.Extensions.DependencyInjection (>= 7.0.0)
- System.Data.SqlClient (>= 4.8.5)
- VTNET.Extensions (>= 2.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on VTNET.Vitado:
| Package | Downloads |
|---|---|
|
VTNET.Vitado.SqlServer
An SqlServer wrapper library |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 7.2.0 | 243 | 8/9/2024 | |
| 7.2.0-beta.17 | 116 | 7/25/2024 | |
| 7.2.0-beta.16 | 100 | 7/24/2024 | |
| 7.2.0-beta.15 | 104 | 7/21/2024 | |
| 7.2.0-beta.14 | 121 | 7/16/2024 | |
| 7.2.0-beta.13 | 81 | 7/16/2024 | |
| 7.2.0-beta.12 | 84 | 7/16/2024 | |
| 7.2.0-beta.11 | 79 | 7/16/2024 | |
| 7.2.0-beta.10 | 83 | 7/15/2024 | |
| 7.2.0-beta.9 | 79 | 7/15/2024 | |
| 7.2.0-beta.8.1 | 94 | 7/15/2024 | |
| 7.2.0-beta.8 | 79 | 7/15/2024 | |
| 7.2.0-beta.7 | 83 | 7/15/2024 | |
| 7.2.0-beta.6 | 86 | 7/15/2024 | |
| 7.2.0-beta.5 | 106 | 7/14/2024 | |
| 7.2.0-beta.4 | 107 | 7/3/2024 | |
| 7.2.0-beta.3 | 124 | 7/1/2024 | |
| 7.2.0-beta.2 | 105 | 6/27/2024 | |
| 7.2.0-beta.1 | 82 | 6/26/2024 | |
| 7.1.0 | 177 | 5/7/2024 | |
| 7.0.2 | 245 | 2/28/2024 | |
| 7.0.1 | 265 | 2/21/2024 | |
| 7.0.0 | 222 | 2/21/2024 | |
| 2.0.10 | 193 | 1/19/2024 | |
| 2.0.9 | 209 | 1/18/2024 | |
| 2.0.8 | 261 | 1/15/2024 | |
| 2.0.7 | 248 | 11/27/2023 | |
| 2.0.6 | 235 | 11/3/2023 | |
| 2.0.5 | 219 | 10/27/2023 | |
| 2.0.4 | 196 | 10/27/2023 | |
| 2.0.3 | 228 | 10/27/2023 | |
| 2.0.2 | 245 | 10/27/2023 | |
| 2.0.1 | 235 | 10/25/2023 | |
| 2.0.0 | 229 | 10/12/2023 | |
| 1.1.3 | 270 | 9/27/2023 | |
| 1.1.2 | 248 | 9/20/2023 | |
| 1.1.1 | 238 | 9/13/2023 | |
| 1.1.0 | 242 | 9/13/2023 | |
| 1.0.15 | 244 | 9/12/2023 | |
| 1.0.14 | 249 | 9/12/2023 | |
| 1.0.13 | 253 | 9/8/2023 | |
| 1.0.12 | 292 | 8/25/2023 | |
| 1.0.11 | 256 | 8/11/2023 | |
| 1.0.10 | 293 | 8/10/2023 | |
| 1.0.9 | 293 | 8/9/2023 | |
| 1.0.8 | 290 | 8/9/2023 | |
| 1.0.7 | 278 | 8/9/2023 | |
| 1.0.6 | 298 | 8/4/2023 | |
| 1.0.5 | 299 | 8/3/2023 | |
| 1.0.4 | 315 | 8/3/2023 | |
| 1.0.3 | 293 | 8/3/2023 | |
| 1.0.2 | 297 | 8/3/2023 | |
| 1.0.1 | 304 | 8/2/2023 | |
| 1.0.0 | 298 | 8/2/2023 |