DataAccess.Library
1.0.15
dotnet add package DataAccess.Library --version 1.0.15
NuGet\Install-Package DataAccess.Library -Version 1.0.15
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="DataAccess.Library" Version="1.0.15" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DataAccess.Library" Version="1.0.15" />
<PackageReference Include="DataAccess.Library" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DataAccess.Library --version 1.0.15
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DataAccess.Library, 1.0.15"
#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.
#:package DataAccess.Library@1.0.15
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DataAccess.Library&version=1.0.15
#tool nuget:?package=DataAccess.Library&version=1.0.15
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
DataAccess - a simple generic object to fetch data in .net
Data Access is used in the CRUD (Create, Retrieve, Update and Delete) operation to database.
Packages
| Package | NuGet Stable | NuGet Pre-release | Downloads |
|---|---|---|---|
| DataAccess.Library |
Features
First declare an instance of the class:
// Program.cs
var connectionString = builder.Configuration.getConnectionString("dbname");
builder.Services.AddScoped<IDbConnection>(conn => new SqlConnection(connectionString));
// Dependency Injection for DbConnectFactory
builder.Services.AddScoped<IDbConnectFactory, DbConnectFactory>();
Method
// This is an example of how to use the DbConnectFactory library
public class UserRepository(IDbConnectFactory dbConnectFactory) : IUserRepository
{
private readonly IDbConnectFactory dbConnect = dbConnectFactory;
public async Task<int> CreateUser(CreateUserDto userDto)
{
// Start the transaction
dbConnect.BeginTransaction();
try
{
// Check if the user name already exists in the system
bool blnExists = await dbConnect.QueryFirstOrDefaultAsync<bool, dynamic>("dbo.spUserExists", CommandType.StoredProcedure, new { userDto.pstrUserName });
if (blnExists) return 0;
// Insert user data in the db
int response = await dbConnect.ExecuteAsync("dbo.spCreateUser", CommandType.StoredProcedure, new
{
userDto.pstrFirstName,
userDto.pstrLastName,
userDto.pstrUserName,
userDto.pstrPassword,
userDto.pstrEmailAddress,
userDto.pstrRole,
userDto.pstrWho
});
// Return the response
if (response != 0)
{
// Commit Transaction
dbConnect.CommitTransaction();
return 1;
}
return 0;
}
catch
{
// Rollback Transaction
dbConnect.RollBackTransaction();
return 0;
}
finally
{
// Dispose Transaction
dbConnect.Dispose();
}
}
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Dapper (>= 2.1.66)
- Microsoft.Data.SqlClient (>= 6.1.2)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.10)
- System.Configuration.ConfigurationManager (>= 9.0.10)
-
net9.0
- Dapper (>= 2.1.66)
- Microsoft.Data.SqlClient (>= 6.1.2)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.10)
- System.Configuration.ConfigurationManager (>= 9.0.10)
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.0.15 | 205 | 11/3/2025 |