PvWayDaoAbstractions 1.0.0

dotnet add package PvWayDaoAbstractions --version 1.0.0
NuGet\Install-Package PvWayDaoAbstractions -Version 1.0.0
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="PvWayDaoAbstractions" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PvWayDaoAbstractions --version 1.0.0
#r "nuget: PvWayDaoAbstractions, 1.0.0"
#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 PvWayDaoAbstractions as a Cake Addin
#addin nuget:?package=PvWayDaoAbstractions&version=1.0.0

// Install PvWayDaoAbstractions as a Cake Tool
#tool nuget:?package=PvWayDaoAbstractions&version=1.0.0

pvWay DAO services abstractions .Net Core 6

This nuGet defines the interfaces for tiny DAO services.

It includes the following interfaces

It comes along with some concrete implementations such as PvWayMsSqlDao, PvWayPgSqlDao...

Interfaces

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.
  • net6.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on PvWayDaoAbstractions:

Package Downloads
PvWayMsSqlDao

Tiny DAO utility with a subset of command execution

PvWayPgSqlDao

Tiny DAO utility with a subset of command execution

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 186 5/25/2023

Initial version