PvWayMsSqlDao 1.0.1
dotnet add package PvWayMsSqlDao --version 1.0.1
NuGet\Install-Package PvWayMsSqlDao -Version 1.0.1
<PackageReference Include="PvWayMsSqlDao" Version="1.0.1" />
paket add PvWayMsSqlDao --version 1.0.1
#r "nuget: PvWayMsSqlDao, 1.0.1"
// Install PvWayMsSqlDao as a Cake Addin #addin nuget:?package=PvWayMsSqlDao&version=1.0.1 // Install PvWayMsSqlDao as a Cake Tool #tool nuget:?package=PvWayMsSqlDao&version=1.0.1
pvWay Ms SQL DAO services .Net Core 6
This nuGet is tiny subset of DAO services based on Ms SQL
It includes the following classes implementing the abstractions of pvWay Dao Service nuGet
Classes
Dependency injection
For the dependency injection you need to use the ServiceCollection extension
AddPvWayMsSqlDaoService passing
- an async delegate for logging any exception raised during execution
- and the Ms SQL Connection string
IDaoService
The DaoService interface contains the contract for two main classes:
- StoredProcExecutor that implements IDaoStoredProcExecutor
- TextCommandExecutor that implements IDaoTextCommandExecutor
Three async methods enable to wrap commands into transactions:
- BeginTransactionAsync
- CommitTransactionAsync
- RollbackTransactionAsync
public interface IDaoService : IAsyncDisposable
{
string GetDatabaseName();
IDaoStoredProcExecutor StoredProcExecutor { get; }
IDaoTextCommandExecutor TextCommandExecutor { get; }
Task<IDbTransaction> BeginTransactionAsync();
Task CommitTransactionAsync();
Task RollbackTransactionAsync();
}
IDaoCommandExecutor
This interface includes two simple methods
- CreateCommand within or without an associated transaction
- Execute a command that returns a scalar object
public interface IDaoCommandExecutor
{
IDbCommand CreateCommand(string commandText,
IDbTransaction? transaction = null);
Task<object?> ExecuteScalarAsync(IDbCommand cmd);
}
IDaoTextCommandExecutor
This extends the IDaoCommandExecutor with two async methods
- Execute Reader, a generic that returns a IEnumerable of object by passing a command and a factory
- Execute NonQueryAsync that executes a command
public interface IDaoTextCommandExecutor : IDaoCommandExecutor
{
Task<IEnumerable<T>> ExecuteReaderAsync<T>(
Func<IDaoReader, T> factor,
IDbCommand cmd);
Task ExecuteNonQueryAsync(IDbCommand cmd);
}
IDaoStoredProcExecutor
This extends the IDaoTextCommandExecutor with one method enabling to pass some string parameters to the stored proc
public interface IDaoStoredProcExecutor : IDaoTextCommandExecutor
{
void AddStringParam(IDbCommand cmd, string paramName, string paramValue);
// feel free to add more param types if needed
}
Enjoy it:=)
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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. 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. |
-
net6.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0.0)
- PvWayDaoAbstractions (>= 1.0.0)
- System.Data.SqlClient (>= 4.8.6)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
fix System.Data.SqlClient 4.8.5 vulnerability