ByteTerrace.Ouroboros.Database 1.0.0-preview11

Prefix Reserved
Additional Details

There is a bug with the way the DbResultSet struct handles field mapping in this version.

This is a prerelease version of ByteTerrace.Ouroboros.Database.
There is a newer prerelease version of this package available.
See the version list below for details.
The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package ByteTerrace.Ouroboros.Database --version 1.0.0-preview11                
NuGet\Install-Package ByteTerrace.Ouroboros.Database -Version 1.0.0-preview11                
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="ByteTerrace.Ouroboros.Database" Version="1.0.0-preview11" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ByteTerrace.Ouroboros.Database --version 1.0.0-preview11                
#r "nuget: ByteTerrace.Ouroboros.Database, 1.0.0-preview11"                
#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 ByteTerrace.Ouroboros.Database as a Cake Addin
#addin nuget:?package=ByteTerrace.Ouroboros.Database&version=1.0.0-preview11&prerelease

// Install ByteTerrace.Ouroboros.Database as a Cake Tool
#tool nuget:?package=ByteTerrace.Ouroboros.Database&version=1.0.0-preview11&prerelease                

Basic Usage

var options = DbClientOptions.New(
    connectionString: "Server=(localdb)\\MSSQLLocalDb;Initial Catalog=master;",
    providerFactory: SqlClientFactory.Instance // Depends on Microsoft.Data.SqlClient package.
);
var client = DbClient.New(options: options);

_ = client
    .ToIDbClient()
    .ExecuteStoredProcedure(
        name: "sp_tables",
        schemaName: "dbo"
    );

ASP.NET Core (Version 6) Integration

appsettings.json (or equivalent)

{
    "ConnectionStrings": {
        "LocalDb": {
            "type": "Microsoft.Data.SqlClient.SqlClientFactory, Microsoft.Data.SqlClient, Version=4.1.0.0, Culture=neutral, PublicKeyToken=23ec7fc2d6eaa4a5",
            "value": "Server=(localdb)\\MSSQLLocalDb;Initial Catalog=master;"
        }
    },
    "Logging": {
        "LogLevel": {
            "ByteTerrace.Ouroboros.Database": "None" // Set to Trace for debugging output.
        }
    }
}

Program.cs

using ByteTerrace.Ouroboros.Database;

var builder = WebApplication.CreateBuilder(args: args);

builder
    .Services
    .AddDbClients(configuration: builder.Configuration);

ValuesController.cs

using ByteTerrace.Ouroboros.Database;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace MyNamespace
{
    [Route("api/[controller]")]
    [ApiController]
    public class ExampleController : ControllerBase
    {
        public IDbClientFactory DbClientFactory { get; }

        public ExampleController(IDbClientFactory dbClientFactory) {
            DbClientFactory = dbClientFactory;
        }

        [AllowAnonymous]
        [HttpGet]
        [Route("test-db-connection")]
        public async ValueTask<IActionResult> TestDbConnection(CancellationToken cancellationToken) {
            using var client = DbClientFactory.NewClient(name: "MyConnection");

            await client.OpenConnectionAsync(cancellationToken: cancellationToken);

            return Ok();
        }
    }
}

NuGet References

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on ByteTerrace.Ouroboros.Database:

Package Downloads
ByteTerrace.Ouroboros.Database.SqlClient

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0-preview13 586 3/1/2022

This is a preview that is not intented for production use.