๐Ÿ› ๏ธ Unleasharp.DB.Base

September 24, 2025 ยท View on GitHub

NuGet version (Unleasharp.DB.Base) Github Pages Documentation Changelog

Unleasharp.DB.Base

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 Query class provides engine-agnostic functionality
  • Engine-specific implementations handle the actual SQL rendering
  • Query building follows standard SQL syntax with fluent method chaining

๐Ÿ“– Documentation Resources

๐Ÿš€ Database Engine Implementations

Database EngineUnleasharp.DB Implementation
MySQL ๐ŸฌUnleasharp.DB.MySQL
SQLite ๐Ÿ’พUnleasharp.DB.SQLite
PostgreSQL ๐Ÿ˜Unleasharp.DB.PostgreSQL
MSSQL ๐Ÿ“ŠUnleasharp.DB.MSSQL
DuckDB ๐Ÿฆ†Unleasharp.DB.DuckDB

๐Ÿ“ฆ Dependencies

๐Ÿ“‹ 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.