๐ ๏ธ Unleasharp.DB.Base
September 24, 2025 ยท View on GitHub

A lightweight, database-agnostic library for .NET that provides connection management, query building, and data serialization capabilities.
๐ฏ Key Concepts
This library provides a foundation for database operations with the following core features:
๐ Connection Handling
- Automatic connection creation and management
- Configurable automatic connection regeneration after specified intervals
- Ensures database connections are always open and ready for use
๐งต Threading Support
- Thread-safe connection management through
ConnectorManager - Each thread receives its own dedicated database connection instance
๐ Query Generation
- Query class: Holds SQL query parameters in an engine-agnostic manner
- QueryBuilder class: Executes queries against the database and maps results to specified types
- Follows fluent interface pattern for intuitive query building
๐ Serialization
- Automatic mapping of database results to C# objects using generic type parameters
- Supports both simple class mapping and attribute-based schema definitions
๐ง Query Generation Architecture
The library follows a CRTP (Curiously Recurring Template Pattern) approach where:
- The base
Queryclass provides engine-agnostic functionality - Engine-specific implementations handle the actual SQL rendering
- Query building follows standard SQL syntax with fluent method chaining
๐ Documentation Resources
- ๐ GitHub Pages Documentation - Complete documentation
- ๐ฏ Getting Started Guide - Quick start guide
- ๐ Changelog - New features and improvements
๐ Database Engine Implementations
| Database Engine | Unleasharp.DB Implementation |
|---|---|
| MySQL ๐ฌ | Unleasharp.DB.MySQL |
| SQLite ๐พ | Unleasharp.DB.SQLite |
| PostgreSQL ๐ | Unleasharp.DB.PostgreSQL |
| MSSQL ๐ | Unleasharp.DB.MSSQL |
| DuckDB ๐ฆ | Unleasharp.DB.DuckDB |
๐ฆ Dependencies
- Unleasharp - Multipurpose library
๐ Version Compatibility
This library targets .NET 6.0 and later versions. For specific version requirements, please check the package dependencies.
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.