MVFC.SQLCraft 1.1.1

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

MVFC.SQLCraft

Biblioteca base para abstração e manipulação de bancos de dados SQL no .NET 9.0.
Fornece interfaces, utilitários e integração com SqlKata.

Instalação

dotnet add package MVFC.SQLCraft

Recursos

  • Abstração de drivers SQL
  • Integração com múltiplos bancos
  • Factory para criação de conexões

Principais Métodos


// Retornar só um objeto
T? QueryFirstOrDefault<T>(Query query, IDbTransaction? tx = null);
Task<T?> QueryFirstOrDefaultAsync<T>(Query query, IDbTransaction? tx = null, CancellationToken ct = default);

// Retornar múltiplos objetos
IEnumerable<T> Query<T>(Query query, IDbTransaction? tx = null);
Task<IEnumerable<T>> QueryAsync<T>(Query query, IDbTransaction? tx = null, CancellationToken ct = default);

// Executar uma query e retornar linhas afetadas
int Execute(Query query, IDbTransaction? tx = null);
Task<int> ExecuteAsync(Query query, IDbTransaction? tx = null, CancellationToken ct = default);

// Executar uma query bruta e retornar linhas afetadas
int Execute(string sql, IDbTransaction? tx = null);
Task<int> ExecuteAsync(string sql, IDbTransaction? tx = null, CancellationToken ct = default);

// Realizar uma transação
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);

Exemplo de transação


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);
});

Licença

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 (5)

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

Package Downloads
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.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.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
1.1.1 332 11/16/2025
1.1.0 331 11/16/2025
1.0.4 240 10/30/2025
1.0.3 228 10/12/2025
1.0.1 209 10/12/2025