MVFC.SQLCraft 3.0.8

dotnet add package MVFC.SQLCraft --version 3.0.8
                    
NuGet\Install-Package MVFC.SQLCraft -Version 3.0.8
                    
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="MVFC.SQLCraft" Version="3.0.8" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MVFC.SQLCraft" Version="3.0.8" />
                    
Directory.Packages.props
<PackageReference Include="MVFC.SQLCraft" />
                    
Project file
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 MVFC.SQLCraft --version 3.0.8
                    
#r "nuget: MVFC.SQLCraft, 3.0.8"
                    
#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 MVFC.SQLCraft@3.0.8
                    
#: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=MVFC.SQLCraft&version=3.0.8
                    
Install as a Cake Addin
#tool nuget:?package=MVFC.SQLCraft&version=3.0.8
                    
Install as a Cake Tool

MVFC.SQLCraft

🇧🇷 Leia em Português

CI codecov License Platform NuGet Version NuGet Downloads

Base library for SQL database abstraction and manipulation in .NET 9.0+.
Provides interfaces, utilities, and integration with SqlKata.

Installation

dotnet add package MVFC.SQLCraft

Features

  • SQL driver abstraction
  • Multi-database integration
  • Connection factory

Main Methods


// Return a single object
T? QueryFirstOrDefault<T>(Query query, IDbTransaction? tx = null);
Task<T?> QueryFirstOrDefaultAsync<T>(Query query, IDbTransaction? tx = null, CancellationToken ct = default);

// Return multiple objects
IEnumerable<T> Query<T>(Query query, IDbTransaction? tx = null);
Task<IEnumerable<T>> QueryAsync<T>(Query query, IDbTransaction? tx = null, CancellationToken ct = default);

// Execute a query and return affected rows
int Execute(Query query, IDbTransaction? tx = null);
Task<int> ExecuteAsync(Query query, IDbTransaction? tx = null, CancellationToken ct = default);

// Execute a raw query and return affected rows
int Execute(string sql, IDbTransaction? tx = null);
Task<int> ExecuteAsync(string sql, IDbTransaction? tx = null, CancellationToken ct = default);

// Perform a transaction
void ExecuteInTransaction(Action<SQLCraftDriver, IDbTransaction> action, IsolationLevel isolation = IsolationLevel.ReadCommitted);
Task ExecuteInTransactionAsync(Func<SQLCraftDriver, IDbTransaction, CancellationToken, Task> action, IsolationLevel isolation = IsolationLevel.ReadCommitted, CancellationToken ct = default);

Transaction Example


await driver.ExecuteInTransactionAsync(async (x, t, ct) => {
    
    await x.ExecuteAsync(new Query("Person")
                                .AsInsert(new 
                                { 
                                    Name = "Bob"
                                }), t, ct);

    var sel = new Query("Person")
                    .Select("Id", "Name")
                    .Where("Name", "Bob");

    var p = await x.QueryFirstOrDefaultAsync<Person>(sel, t, ct);
    Assert.NotNull(p);

    var upd = new Query("Person")
                    .Where("Id", p!.Id)
                    .AsUpdate(new 
                    { 
                        Name = "Robert" 
                    });
    
    var upaff = await x.ExecuteAsync(upd, t, ct);
    Assert.Equal(1, upaff);

    var sel2 = new Query("Person")
                    .Select("Id", "Name")
                    .Where("Id", p.Id);

    var p2 = await x.QueryFirstOrDefaultAsync<Person>(sel2, t, ct);
    
    Assert.NotNull(p2);
    Assert.Equal("Robert", p2!.Name);
});

License

MIT

Product Compatible and additional computed target framework versions.
.NET 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 is compatible.  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.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on MVFC.SQLCraft:

Package Downloads
MVFC.SQLCraft.MsSQL

MVFC.SQLCraft.MsSQL: Extensão para acesso Microsoft SQL Server usando MVFC.SQLCraft. Integração simplificada e segura para bancos SQL Server em .NET 9.

MVFC.SQLCraft.Mysql

MVFC.SQLCraft.Mysql: Extensão para acesso MySQL usando MVFC.SQLCraft. Integração simplificada e segura para bancos MySQL em .NET 9.

MVFC.SQLCraft.PostgreSql

MVFC.SQLCraft.PostgreSql: Extensão para acesso PostgreSQL usando MVFC.SQLCraft. Fornece integração simplificada e segura para bancos PostgreSQL em .NET 9.

MVFC.SQLCraft.SQLite

MVFC.SQLCraft.SQLite: Extensão para acesso SQLite usando MVFC.SQLCraft. Integração simplificada e segura para bancos SQLite em .NET 9.

MVFC.SQLCraft.Firebird

MVFC.SQLCraft.Firebird: Extensão para acesso Firebird usando MVFC.SQLCraft. Integração simplificada e segura para bancos Firebird em .NET 9.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.8 0 3/15/2026
3.0.7 0 3/15/2026
3.0.6 38 3/12/2026
3.0.5 34 3/12/2026
3.0.4 34 3/12/2026
3.0.3 42 3/11/2026
3.0.2 40 3/11/2026
3.0.1 43 3/11/2026
2.0.1 167 2/20/2026
1.1.1 339 11/16/2025
1.1.0 338 11/16/2025
1.0.4 247 10/30/2025
1.0.3 237 10/12/2025
1.0.1 216 10/12/2025