PvWayMsSqlDao 1.0.1

dotnet add package PvWayMsSqlDao --version 1.0.1
NuGet\Install-Package PvWayMsSqlDao -Version 1.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="PvWayMsSqlDao" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PvWayMsSqlDao --version 1.0.1
#r "nuget: PvWayMsSqlDao, 1.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 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.1 102 1/26/2024
1.0.0 138 5/25/2023

fix System.Data.SqlClient 4.8.5 vulnerability