IceCoffee.Db4Net.Core
1.2.3
dotnet add package IceCoffee.Db4Net.Core --version 1.2.3
NuGet\Install-Package IceCoffee.Db4Net.Core -Version 1.2.3
<PackageReference Include="IceCoffee.Db4Net.Core" Version="1.2.3" />
<PackageVersion Include="IceCoffee.Db4Net.Core" Version="1.2.3" />
<PackageReference Include="IceCoffee.Db4Net.Core" />
paket add IceCoffee.Db4Net.Core --version 1.2.3
#r "nuget: IceCoffee.Db4Net.Core, 1.2.3"
#:package IceCoffee.Db4Net.Core@1.2.3
#addin nuget:?package=IceCoffee.Db4Net.Core&version=1.2.3
#tool nuget:?package=IceCoffee.Db4Net.Core&version=1.2.3
IceCoffee.Db4Net
| Package | NuGet Stable | Downloads |
|---|---|---|
| IceCoffee.Db4Net | ||
| IceCoffee.Db4Net.DependencyInjection |
Description
A simple and performant SQL builder and runner for Dapper, using a fluent API and string interpolation to build safe and dynamic SQL queries.
Quick Start
Below are a few common ways to configure and use IceCoffee.Db4Net. For more detailed examples, see the project documentation.
1) Quick (static facade)
using IceCoffee.Db4Net;
using IceCoffee.Db4Net.Core;
// register default database (convenience API)
Db.Register(DatabaseProvider.SQLite, "Data Source=sample.db");
// configure global options (parameter name prefix, reuse flags, etc.)
Db.Configure(new Db4NetSettings { ParameterNamePrefix = "p_", ReuseParameters = true });
// use static facade builders
var foo = Db.Query<Foo>(1).GetSingleOrDefault();
2) Recommended (Dependency Injection)
// Program.cs / Startup.cs
builder.Services.AddDbConnection<MyRepository>(options =>
{
options.DatabaseProvider = DatabaseProvider.SQLite;
options.ConnectionString = configuration.GetConnectionString("Default");
});
// later: inject `MyRepository` where needed
3) Tests or isolated scenarios (local registry)
// create an isolated registry (useful for tests)
var registry = Db.CreateDatabaseRegistry();
registry.Configure(Db.Registry.Settings);
registry.Register(DatabaseProvider.SQLite, "Data Source=InMemorySample;Mode=Memory;Cache=Shared");
var repo = new Repository(registry, string.Empty);
Note: The library exposes a global Db.Registry for convenience, but DI or local registries are recommended for applications and tests to avoid shared mutable state.
Execution Behavior
Db4Net owns and disposes connections that it creates internally after buffered query or command execution completes. Connections supplied through an external transaction remain owned by the caller.
Unbuffered queries (buffered: false) require an external connection or transaction so enumeration happens while the caller still controls the connection lifetime.
Paged queries can also be executed through ISqlQueryPagedBuilder and ISqlQueryPagedBuilder<TEntity> when repository code needs to depend on an abstraction instead of the concrete fluent builder type.
Share Your Feedback
If you like the library, use it, share it, and give it a ⭐️. For any suggestions, feature requests, or issues feel free to create an issue to help improve the library.
License
This project is licensed under the MIT License. See the LICENSE file for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. 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. |
| .NET Framework | net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
.NETFramework 4.6.2
- System.ValueTuple (>= 4.6.1)
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on IceCoffee.Db4Net.Core:
| Package | Downloads |
|---|---|
|
IceCoffee.Db4Net
A simple and performant SQL builder and runner for Dapper to build safe and dynamic SQL queries. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.2.3 | 43 | 6/20/2026 |
| 1.2.2 | 142 | 4/25/2026 |
| 1.2.1 | 113 | 4/22/2026 |
| 1.2.0 | 176 | 4/18/2026 |
| 1.1.1 | 453 | 11/19/2025 |
| 1.1.0 | 326 | 11/12/2025 |
| 1.0.8 | 589 | 7/22/2025 |
| 1.0.7 | 143 | 7/19/2025 |
| 1.0.6 | 248 | 7/6/2025 |
| 1.0.5 | 199 | 7/6/2025 |
| 1.0.4 | 206 | 7/6/2025 |
| 1.0.2 | 233 | 6/24/2025 |
| 1.0.1 | 272 | 6/23/2025 |
| 1.0.0 | 226 | 6/23/2025 |