Skip to content
CAI
Software that uses CAICheck a score

Sean-Lu/DbRepository

45.5

Weak · 20 September 2026

23.8k

lines of production code

C#

primary language

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a .NET data access library that provides a unified repository pattern and CodeFirst/DbFirst schema management capabilities across a wide variety of relational databases. It supports both raw ADO.NET and Dapper execution models, offering fluent SQL builders, expression-tree-based query translation, and automatic schema generation or reverse-engineering. The library handles connection lifecycle management, SQL monitoring, and concurrency safety while abstracting away database-specific dialect differences for platforms like MySQL, Oracle, SQLite, and ClickHouse.

How it got here

2021 — database expansion and API modernization

15 changes.

The project significantly expanded database support to include numerous new providers while refactoring the core API to decouple direct SQL execution from the repository abstraction. This period involved modernizing the codebase for .NET 8, removing legacy .NET Framework and linq2db components, and introducing a fluent SQL builder with enhanced caching and monitoring capabilities.

2022–2026 — Multi-database repository expansion

34 changes.

This period focused on significantly expanding the DbRepository library to support a wide array of database providers, including Oracle, ClickHouse, DuckDB, and various specialized engines. The work involved implementing comprehensive CodeFirst schema generation, DbFirst metadata extraction, and dynamic SQL building capabilities tailored to each database dialect. Additionally, the project introduced robust concurrency controls, SQL monitoring hooks, and extensive example applications to demonstrate these new multi-platform features.

Features

Added EF Core repository base class and test implementation

The demo application now includes a generic EF Core repository pattern implementation. A new \EFBaseRepository\ abstract class provides standard CRUD operations (Add, Delete, Update, Query, Get, Count) and raw SQL execution, utilizing \AsNoTracking\ for read-only queries to improve performance. A concrete \TestRepository\ is provided to demonstrate usage with the \TestEntity\ model.

examples/EntityFramework/NetCore/Example.EF.Core.ConsoleApp/Repositories · high confidence

Added entity models for database schema testing

The example application now includes base and specific entity classes to demonstrate data mapping behaviors. A new EntityBase class provides a common structure with an identity primary key and audit timestamps. Two concrete entities, TestEntity and TestUpperEntity, are introduced to showcase different naming conventions: TestEntity uses default lowercase table and column names, while TestUpperEntity explicitly maps to uppercase table and column names (e.g., 'TEST', 'ID'), supporting scenarios like DB2 or Oracle where case sensitivity matters.

examples/EntityFramework/NetCore/Example.EF.Core.ConsoleApp/Entities · high confidence

Expanded database support and configuration in the ADO.NET Core domain example

The example application now includes dedicated test scripts and configuration for a wider range of databases, including Oracle (with INSERT RETURNING support), QuestDB, MsAccess, Firebird, OpenGauss, HighgoDB, IvorySQL, DB2, Informix, ClickHouse, Dameng, KingbaseES, ShenTong, and Xugu. The DI extension (DIExtensions.cs) has been updated to register these providers dynamically via conditional compilation symbols (e.g., UseOracle, UseMsAccess) and includes specific workarounds for known issues, such as legacy timestamp behavior for PostgreSQL-based engines and synchronous write locking for SQLite. Additionally, helper extensions for ODBC/OleDb connections and a custom type handler for Xugu decimals have been added to support these new integrations.

examples/ADO.NET/NetCore/Example.ADO.NETCore.Domain/Extensions · high confidence

Expanded database support with new SQL generation templates

The Example.Common location now includes generated SQL CREATE TABLE scripts for a significantly wider range of database engines, including ClickHouse, DB2, Dameng, DuckDB, Firebird, HighgoDB, Informix, IvorySQL, KingbaseES, MariaDB, MsAccess, OceanBase, OpenGauss, Oracle 11g/12c, QuestDB, ShenTong, TiDB, and Xugu. These templates, generated by CodeFirst.ISqlGenerator, provide the specific DDL syntax required for each platform. Additionally, the internal Constants class was moved from the core library to this example project to support multi-statement separation in the generated scripts.

examples/Example.Common · high confidence

Initial domain model and repository contracts for ADO.NET Core example

The example project now includes a foundational domain layer with base and concrete entity classes (EntityBase, UserEntity, TestEntity) that utilize CodeFirst conventions, automatic timestamp updates, and index definitions. Repository interfaces (ITestRepository, IUserRepository) have been added to define data access contracts, including CRUD operations with transaction support, establishing the structure for the ADO.NET Core demonstration.

examples/ADO.NET/NetCore/Example.ADO.NETCore.Domain/Entities · high confidence

Introduce CodeFirst SQL generation with multi-dialect support and concurrency safety

The CodeFirst subsystem now includes a dedicated SQL generator layer that produces CREATE TABLE and ALTER TABLE statements for a wide range of databases, including MySQL, MariaDB, TiDB, OceanBase, SQL Server, Oracle, SQLite, DuckDB, MsAccess, Firebird, PostgreSQL, OpenGauss, HighgoDB, IvorySQL, QuestDB, DB2, Informix, ClickHouse, Dameng, KingbaseES, ShenTong, and Xugu. This update adds support for creating indexes where the database allows it (e.g., TiDB, SQLite, PostgreSQL), handles dialect-specific type conversions (such as MySQL's case-insensitive field name matching and boolean literal formatting), and ensures thread-safe initialization of shared generators via a factory with per-instance locking.

src/Sean.Core.DbRepository/CodeFirst/SqlGenerator · high confidence

Introduce SqlBuilder for dynamic SQL generation

The SqlBuilder component in src/Sean.Core.DbRepository/SqlBuilder has been introduced to provide a fluent API for dynamically constructing SQL statements. This includes dedicated builders for CRUD operations (Queryable, Insertable, Updateable, Deleteable, Replaceable, Countable) as well as clause-specific builders for ordering and table names. The implementation supports complex query features such as multi-table joins (Inner, Left, Right, Full), conditional filtering via WhereIF, and database-specific optimizations like returning auto-increment IDs and parameterized queries. It also includes a helper Table class for extracting formatted field names and table names from expressions.

src/Sean.Core.DbRepository/SqlBuilder · high confidence

Introduces DbFirst code generation for Dameng, Firebird, and MsAccess databases

The DbFirst module now supports code generation for Dameng, Firebird, and MsAccess databases. This is achieved by adding specific code generators (CodeGeneratorForDameng, CodeGeneratorForFirebird, CodeGeneratorForMsAccess) that query their respective system catalogs to retrieve table metadata, field definitions, and foreign key references. These new generators are registered in the CodeGeneratorFactory, allowing the DbFirst feature to automatically detect and use the correct implementation based on the configured database type.

src/Sean.Core.DbRepository/DbFirst · high confidence

Introduces thread-safe caching for entity metadata and table existence checks

The repository now includes dedicated cache classes for managing database schema information. EntityInfoCache stores metadata for entity classes, including table names, field details, join configurations, and index definitions, using a thread-safe dictionary with locking to prevent race conditions during metadata construction. TableInfoCache tracks which tables and fields exist in the database for a given connection key, using a nested dictionary structure to ensure thread safety and avoid cache collisions between different databases or master/slave instances.

src/Sean.Core.DbRepository/Cache · high confidence

Introduction of Default SQL Monitor Implementation

A new DefaultSqlMonitor class has been added to the SqlMonitor component, implementing the ISqlMonitor interface to handle SQL execution events. This implementation exposes SqlExecuting and SqlExecuted events and ensures that these events are propagated to the global DbContextConfiguration.Options when not explicitly handled by the context, enabling users to hook into database query lifecycle events for monitoring or logging purposes.

src/Sean.Core.DbRepository/SqlMonitor · high confidence

Introduction of SQL execution context objects for monitoring

The repository now exposes \SqlExecutingContext\ and \SqlExecutedContext\ classes to provide structured data during SQL operations. These contexts carry connection details, transaction state, SQL text, and parameters, allowing for interception and monitoring of database activity. \SqlExecutedContext\ additionally tracks execution elapsed time and exceptions, enabling users to observe performance and errors after execution.

src/Sean.Core.DbRepository/Context · high confidence

New CodeFirst attributes for schema configuration and joins

The DbRepository attributes now include new configuration options for CodeFirst database generation. Users can define database indexes via the new IndexAttribute, specify table naming conventions with NamingConventionAttribute, and configure numeric precision using NumericAttribute. The library also introduces LeftJoinAttribute and LeftJoinFieldAttribute to enable declarative left-join queries. Additionally, the previous IgnoreAttribute has been replaced by AutoUpdateCurrentTimestampAttribute to support MySQL's ON UPDATE CURRENT\_TIMESTAMP behavior, and SequenceAttribute now defaults to using triggers for Oracle sequence generation.

src/Sean.Core.DbRepository/Attributes · high confidence

New CodeFirst database migration contracts

The library introduces new interfaces for CodeFirst database management: IDatabaseUpgrader, which allows upgrading entity classes to the database by type or assembly, and ISqlGenerator, which provides methods to initialize database connections and generate SQL scripts for creating and upgrading tables. These contracts enable programmatic schema evolution based on entity definitions.

src/Sean.Core.DbRepository/CodeFirst/Contracts · high confidence

New Dapper Core example application with multi-database support

The examples/Dapper location now includes a complete .NET Core example application (Example.Dapper.Core) demonstrating the Dapper-based data access layer. This includes domain entities (TestEntity, UserEntity, CheckInLogEntity), application services (TestService, UserService, CheckInLogService), and repository contracts. The example is configured to support a wide range of databases including MySQL, SQL Server, Oracle, PostgreSQL, SQLite, DuckDB, MS Access, Firebird, TiDB, OceanBase, MariaDB, OpenGauss, HighgoDB, IvorySQL, QuestDB, DB2, Informix, ClickHouse, Dameng, KingbaseES, ShenTong, and Xugu, with specific type handlers and connection configurations for each.

examples/Dapper · high confidence

New DatabaseUpgrader class for CodeFirst schema migrations

A new DatabaseUpgrader class has been added to the CodeFirst module, providing a concrete implementation of IDatabaseUpgrader. This component allows users to apply database schema changes by upgrading specific entity types or scanning assemblies for types marked with CodeFirstAttribute. It handles SQL generation via a factory pattern based on the database type and executes the resulting upgrade scripts against the database.

src/Sean.Core.DbRepository/CodeFirst · high confidence

New EF Core console demo with multi-database support and repository pattern

The Example.EF.Core.ConsoleApp project has been introduced as a comprehensive demonstration of Entity Framework Core usage. It features a generic IEFBaseRepository interface and a concrete TestRepository implementation to showcase CRUD operations, including specific behaviors like no-tracking queries and SQL Server paging without ORDER BY. The application is configured to dynamically connect to a wide variety of databases—including MySQL, MariaDB, TiDB, OceanBase, SQL Server, Oracle, SQLite, MS Access, Firebird, PostgreSQL, OpenGauss, HighgoDB, IvorySQL, DB2, Informix, ClickHouse, Dameng, KingbaseES, and ShenTong—using conditional compilation constants to select the appropriate provider and connection settings at build time.

examples/EntityFramework/NetCore/Example.EF.Core.ConsoleApp · high confidence

New NuGet publishing and CI verification scripts

Added Publish-NuGet.ps1 to automate building, packing, and pushing Sean.Core.DbRepository and Sean.Core.DbRepository.Dapper packages to local or official NuGet feeds, ensuring DLL/PDB consistency via forced rebuilds. Added Verify.ps1 to enforce CI gates by auditing dependencies for vulnerabilities, comparing compiler warnings against a baseline, running tests with code coverage, and validating package generation.

scripts · high confidence

New application service examples for ADO.NET Core

Added new example services (TestService, TestSimpleService, UserService) and their corresponding contracts (ITestService, ITestSimpleService, IUserService) in the Example.ADO.NETCore.Application project. These services demonstrate CRUD operations, transaction handling, and repository usage for TestEntity and UserEntity, providing concrete implementation patterns for the ADO.NET Core data access layer.

examples/ADO.NET/NetCore/Example.ADO.NETCore.Application/Services · high confidence

New configuration options for connection strings, synchronous writes, and output parameters

Added new option classes to the \Sean.Core.DbRepository\ library to improve configuration flexibility and concurrency handling. \ConnectionStringOptions\ introduces a structured way to define database connections, including support for creating instances from \IConfiguration\ (for .NET Standard 2.1+ / .NET 5+) and parsing connection strings to auto-detect provider details. \SynchronousWriteOptions\ allows enabling a synchronous write mode with configurable lock timeouts, primarily to resolve SQLite concurrency lock issues. \OutputParameterOptions\ now supports writing back Guid values from text-based output parameters, and \DbOptions\ exposes these new settings along with type handlers and SQL execution hooks.

src/Sean.Core.DbRepository/Option · high confidence

New demo implementations for CodeFirst, DbFirst, and basic DB operations

The console application now includes three new example implementations in the Impl folder: CodeFirstTest demonstrates schema generation and upgrade capabilities for SQLite using the SqlGenerator and DatabaseUpgrader; DbFirstTest shows how to retrieve table metadata and field references from an existing SQLite database; and DBTest provides a basic CRUD execution entry point using the configured test service.

examples/ADO.NET/NetCore/Example.ADO.NETCore.ConsoleApp/Impls · high confidence

New example repository implementations with SQL monitoring and auto-table creation

The repository layer now includes new example implementations (CommonRepository, TestRepository, UserRepository) that demonstrate using the ADO.NET provider (with Dapper available via commented code). These repositories integrate SQL execution monitoring via OnSqlExecuting/OnSqlExecuted hooks, logging SQL details and exceptions using ILogger and a custom DbParameterCollectionConverter. TestRepository specifically demonstrates CRUD operations, auto-creating tables if they don't exist, and supports various database types (SQLite is active; others are commented out).

examples/ADO.NET/NetCore/Example.ADO.NETCore.Domain/Repositories · high confidence

New expression-tree-based WHERE clause parser for dynamic queries

The repository now includes a new \ExpressionResolve\ layer that translates LINQ expression trees into SQL WHERE clauses. This adds support for dynamic lambda-based filtering, including standard comparisons, logical AND/OR, \IN\/\NOT IN\ checks (with safe handling of lazy enumerables), \LIKE\/\NOT LIKE\ string matching (with database-specific escaping, including QuestDB), and \IS NULL\/\IS NOT NULL\ for nullable fields. Users can now pass complex expression predicates to query methods instead of relying solely on static query builders.

src/Sean.Core.DbRepository/ExpressionResolve · high confidence

New extension methods for database command execution and entity mapping

This change introduces a suite of new extension methods in the \Sean.Core.DbRepository.Extensions\ namespace to enhance database interaction and data mapping. \DbCommandExtensions\ and \DbDataAdapterExtensions\ provide synchronous and asynchronous wrappers for standard ADO.NET operations (ExecuteNonQuery, ExecuteReader, ExecuteScalar, ExecuteDataSet, ExecuteDataTable) that integrate with the \ISqlMonitor\ for SQL monitoring. \DbParameterExtensions\ adds logic to correctly map .NET types to database parameter types, including specific handling for enums, booleans in Oracle, and custom type handlers. \EntityExtensions\ adds a \ResetEntityState\ method to reset entity tracking state. \DataRowExtensions\ and \DataTableExtensions\ are updated to use a new \ResultValueMapping\ and \EntityPropertyMapping\ system for more robust and performant conversion of database rows to entities, supporting tuples, nullable types, and custom naming conventions. Additionally, \RepositoryExtensions\ provides factory methods to create various SQL builders (Insert, Update, Delete, Query, etc.) directly from a repository instance.

src/Sean.Core.DbRepository/Extensions · high confidence

New utility classes for SQL generation, parameter handling, and write synchronization

Added several new utility classes in the \Util\ namespace to support dynamic SQL building and concurrent write safety. \FieldExpressionUtil\ and \WhereExpressionUtil\ provide helper methods for constructing and manipulating LINQ expressions for field selection and WHERE clauses, including support for ignoring specific fields. \SqlBuilderUtil\ assists in managing table field metadata, including inclusion/exclusion logic and aggregate function handling. \SqlParameterUtil\ handles the parsing, filtering, and conversion of SQL parameters to database-specific formats, while \SynchronousWriteUtil\ introduces a semaphore-based locking mechanism to serialize write operations per database connection, preventing concurrency issues during synchronous writes.

src/Sean.Core.DbRepository/Util · high confidence

Repository and SQL builder contracts restructured and expanded

The \IBaseRepository\ interface has been significantly expanded to expose synchronous and asynchronous raw SQL execution methods (such as \Execute\, \Query\, \Get\, \ExecuteScalar\, \ExecuteDataTable\, and \ExecuteDataSet\) alongside table management operations like \DeleteAll\, \DropTable\, and \AddTableField\. The repository now exposes a \DbFactory\ and \DbType\ property. Additionally, a comprehensive set of new interfaces has been introduced to support a fluent SQL building API, including \IBaseSqlBuilder\, \IQueryable\, \IInsertable\, \IUpdateable\, \IDeleteable\, \IReplaceable\, and \ICountable\, along with specialized clauses for joins, ordering, grouping, and filtering. A new \ISqlMonitor\ interface enables SQL execution event tracking, and \PageQueryResult\ provides a standard model for paginated query outcomes.

src/Sean.Core.DbRepository/Contracts · high confidence

Removals

Removal of BaseRepository implementation

The \BaseRepository\ class in the \Sean.Core.DbRepository.Dapper.Impls\ namespace has been deleted. This removes the concrete implementation of the base repository pattern that previously handled synchronous and asynchronous CRUD operations (Add, Delete, Update, Query) and table existence checks for entity types.

src/Sean.Core.DbRepository.Dapper/Impls, src/Sean.Core.DbRepository/Impls · high confidence

Removal of CheckInLog application layer and infrastructure constants

The CheckInLog feature's application-layer components have been removed from the Example.Application project. This includes the deletion of the CheckInLogDto, the ICheckInLogService interface, the CheckInLogService implementation, and the associated AutoMapperProfile. Additionally, the empty Constants class in the Example.Infrastructure project has been removed. Users of this example application will no longer have access to the CheckInLog search functionality or its related data transfer objects.

examples/NetCore/Example.Application · high confidence

Removal of legacy .NET Framework example project

The .NET Framework example project (Example.NetFramework) has been removed from the repository. This change deletes the project's entry point (Program.cs) and its configuration file (App.config), which previously contained hardcoded MySQL connection strings and provider factory registrations. Users relying on this specific example for .NET Framework integration will no longer have access to these files.

examples/NetFramework/Example.NetFramework · high confidence

Removed CheckInLogRepository and its interface

The \ICheckInLogRepository\ interface and the \CheckInLogRepository\ implementation have been removed from the domain layer. This eliminates the custom repository pattern previously used for managing check-in log entities, including the specific \SearchAsync\ method that executed SQL queries with pagination.

examples/NetCore/Example.Domain · high confidence

Removed MySQL example test file

The MySQL-specific example test class (MySqlTest.cs) has been removed from the examples project. This file previously contained demonstration code for basic CRUD operations and query execution using MySQL, which is no longer included in this location.

examples/NetFramework/Example.NetFramework/Impls · high confidence

Removed database-specific test implementations

The example application no longer includes the database-specific test classes for DB2, Firebird, Informix, MySQL, Oracle, PostgreSQL, SQLite, SQL Server Compact, and SQL Server. These files, which previously served as isolated test runners for each database provider, have been deleted from the \Impls/DbTest\ directory, simplifying the example project structure.

examples/NetCore/Example.NetCore/Impls · high confidence

Behavioural changes

Centralized build configuration and CI NuGet settings

The project now uses a shared configuration file (Common.props) to standardize build properties, including enabling symbol package generation (snupkg) and integrating SourceLink for improved debugging. Additionally, a dedicated CI NuGet configuration file has been introduced to explicitly define package sources for build verification and dependency auditing.

config · high confidence

Database extension methods now use ISqlCommand instead of IBaseRepository

The \DbConnectionExtensions\ methods (such as \Execute\, \Query\, \Get\, and \ExecuteScalar\) have been refactored to accept an \ISqlCommand\ object and an optional \ISqlMonitor\ instead of requiring an \IBaseRepository\ instance. This change decouples direct database operations from the repository abstraction, allowing users to execute SQL commands directly on a connection without instantiating or passing a repository object. The new signature also integrates the \ISqlMonitor\ for potential AOP-based SQL monitoring.

src/Sean.Core.DbRepository.Dapper/Extensions · high confidence

Expanded database support and configuration refactoring

The repository now supports a significantly wider range of databases, adding enum values for MariaDB, TiDB, OceanBase, DuckDB, MS Access, OpenGauss, HighgoDB, IvorySQL, QuestDB, ClickHouse, Dameng, KingbaseES, ShenTong, and Xugu. To support this, the internal configuration model has been refactored: the \ConnectionStringOptions\ and \DbCommandInfo\ classes have been removed, and \MultiConnectionStrings\ has been deleted in favor of a new \DbProviderFactoryManager\ that automatically resolves providers and database types. Additionally, a new \SqlOperation\ enum has been introduced to support expression-tree-based queries.

src/Sean.Core.DbRepository · high confidence

Expanded database support in the ADO.NET Core console example

The Example.ADO.NETCore.ConsoleApp has been updated to demonstrate support for a significantly wider range of database providers. The appsettings.json configuration now includes connection strings and database type mappings for MariaDB, TiDB, OceanBase, DuckDB, MS Access, Firebird, OpenGauss, HighgoDB, IvorySQL, QuestDB, DB2, Informix, ClickHouse, Dameng, KingbaseES, ShenTong, and Xugu, in addition to the previously supported databases. The application entry point (Program.cs) and contract interface (ISimpleDo) have been added to facilitate running these specific database tests.

examples/ADO.NET/NetCore/Example.ADO.NETCore.ConsoleApp · high confidence

Introduce DefaultSqlAdapter for database-specific SQL formatting

The repository now uses a new DefaultSqlAdapter class to handle SQL identifier formatting (tables, fields, parameters) based on the target database type. This adapter ensures that table names, field names, and SQL parameters are correctly quoted and formatted according to the specific database dialect (e.g., Oracle, MS Access), supporting multi-table queries with aliases and improving compatibility across different database providers.

src/Sean.Core.DbRepository/SqlAdapter · high confidence

Introduction of BaseRepository with comprehensive CRUD and CodeFirst capabilities

The repository layer now includes a new BaseRepository class that provides a unified interface for database operations. This change introduces support for multiple database providers (including Oracle, ClickHouse, DuckDB, MS Access, and Firebird) and adds significant functionality such as CodeFirst auto-table creation, bulk operation limits, SQL monitoring via AOP, and various CRUD methods (including PageQuery, DeleteAll, and UpdateByDto). It also addresses several concurrency and transaction stability issues, ensuring safer handling of shared generators and connection lifecycles.

src/Sean.Core.DbRepository/Repository · high confidence

Introduction of DefaultSqlCommand for unified SQL execution and parameter handling

The repository layer now uses a new DefaultSqlCommand class to manage SQL commands, providing a centralized way to handle database-specific parameter binding (named vs. positional/question-mark), parameter removal, and SQL string conversion. This change standardizes how parameters are processed across different database types, ensuring consistent behavior for CRUD operations and fixing issues related to parameter sharing and auto-increment ID retrieval.

src/Sean.Core.DbRepository/SqlModel · high confidence

Refactor configuration classes to NETFRAMEWORK-only and simplify provider mapping

The configuration classes in \src/Sean.Core.DbRepository/Config\ (including \ConfigBuilder\, \DatabaseElement\, \DatabaseElementCollection\, \DbProviderMap\, and \DbProviderMapSection\) are now restricted to the .NET Framework target via \\#if NETFRAMEWORK\ directives, removing their availability in .NET Standard/Core builds. \ConfigBuilder\ no longer attempts to load configuration from a local DLL config file, relying instead on \ConfigurationManager\. \DatabaseElement\ and \DbProviderMap\ constructors and properties have been simplified, removing the \DatabaseType\ enum dependency in favor of string-based identifiers. Additionally, new static configuration entry points \DbContextConfiguration\ and \MultiConnectionSettings\ have been introduced to manage \DbOptions\ and connection string loading, with \MultiConnectionSettings\ supporting both .NET Framework and modern .NET targets for master/slave connection resolution.

src/Sean.Core.DbRepository/Config · high confidence

Refactored Dapper repository execution to unify connection lifecycle and fix reader resource release

The Dapper repository layer now delegates all database operations (Execute, Query, Get, etc.) through a new internal \DapperRepositoryExecutor\ class. This change consolidates repeated execution logic and ensures consistent connection lifecycle management. Specifically, it fixes a resource leak in synchronous and asynchronous \ExecuteReader\ methods by explicitly setting \CommandBehavior.CloseConnection\ when no external transaction or connection is provided, ensuring the internal connection is properly closed after the reader is consumed.

src/Sean.Core.DbRepository.Dapper/Repository · high confidence

Refactored database factory and SQL builder APIs for .NET 5+ and improved connection management

The \DbFactory\ class has been modernized to support .NET 5 and later via \Microsoft.Extensions.Configuration\, while retaining compatibility with older frameworks through conditional compilation. It now exposes explicit properties for \ProviderFactory\, \DbType\, and \CommandTimeout\, and introduces a \SqlMonitor\ for tracking SQL execution. The \SqlFactory\ has been significantly simplified: the previous instance-based builder pattern (e.g., \SqlFactory.Build(...)\) is replaced by static factory methods like \CreateReplaceableBuilder\, and the internal SQL generation logic has been streamlined. Additionally, connection handling improvements include better resource cleanup for failed initializations and consistent transaction management for operations like \AddOrUpdate\.

src/Sean.Core.DbRepository/Factory · high confidence

Refactored dependency injection and added JSON serialization infrastructure

The infrastructure layer has been reorganized to support .NET Core ADO.NET examples. A new \DIManager\ class provides a centralized way to configure services and build the service provider, while \DIExtensions\ now registers the \NewJsonSerializer\ implementation for the \IJsonSerializer\ interface and sets up simple local logging. Additionally, a \DbParameterCollectionConverter\ has been added to enable JSON serialization of database parameters, and the existing service registration helpers have been renamed and refined for better clarity.

examples/ADO.NET/NetCore/Example.ADO.NETCore.Infrastructure · high confidence

Simplified application dependency injection registration

The application layer's dependency injection setup has been streamlined by replacing the previous manual configuration of AutoMapper and generic assembly service registration with a single call to \RegisterByInterfaceSuffix\. This change removes the explicit AutoMapper setup (including null collection and destination value handling) and the previous \RegisterServicesByAssemblyInterface\ method, relying instead on the new helper to register services by interface suffix. The file has also been renamed from \ServiceCollectionExtensions.cs\ to \DIExtensions.cs\ and moved to the ADO.NET Core example structure.

examples/ADO.NET/NetCore/Example.ADO.NETCore.Application/Extensions · high confidence

Solution renamed and restructured with expanded database support

The solution file has been renamed from Sean.Core.DbRepository.sln to DbRepository.sln and upgraded to Visual Studio 17. The project structure was reorganized: the linq2db adapter and code generator projects were removed, and new example projects for Dapper and ADO.NET were added under dedicated solution folders. The README was significantly updated to reflect support for a wider range of databases (including MariaDB, TiDB, DuckDB, ClickHouse, Dameng, etc.) and features like bulk insert performance improvements, while a new MIT LICENSE file was added.

(repo-wide) · high confidence

Test coverage

Added EF Core CRUD demonstration tests; Added MySQL integration tests; Added base test classes for Dapper repository tests; Added comprehensive test coverage for DbRepository core behaviors.

Dependencies

Upgrade to .NET 8 and update core dependencies

The example projects have been migrated from .NET Core 3.1 to .NET 8, and the core library now targets .NET 8 alongside legacy frameworks. The Dapper dependency has been upgraded from version 2.0.90 to 2.1.35, and the library version has been bumped to 2.2.0. Additionally, the linq2db integration and code generator projects have been removed, and the example infrastructure now uses Microsoft.Extensions.Configuration and DependencyInjection versions 10.0.12.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 39 → 46 (+6.9)
  • Rubric changed (rubric-2026.08.17 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 47 → 46 (-0.6)
  • Architecture 81 → 81 (+0.5)
  • Maturity 45 → 57 (+12.4)
  • Readiness 30 → 39 (+9.7)
  • Security 42 → 42 (+0.2)
  • Domain Modelling 95 (new)

Resolved (128)

  • Banned license: MySql.Data
  • BaseRepository.Add (cognitive 18) (src/Sean.Core.DbRepository/Repository/BaseRepository.cs)
  • BaseRepository.Add (cyclomatic 17) (src/Sean.Core.DbRepository/Repository/BaseRepository.cs)
  • BaseRepository.AddAsync (cognitive 18) (src/Sean.Core.DbRepository/Repository/BaseRepository.cs)
  • BaseRepository.AddAsync (cyclomatic 17) (src/Sean.Core.DbRepository/Repository/BaseRepository.cs)
  • Bounded contexts not declared
  • Build did not complete in the analyzer
  • CRAP 199: QueryableSqlBuilder.BuildSqlCommand (src/Sean.Core.DbRepository/SqlBuilder/QueryableSqlBuilder.cs)
  • CRAP 235: DatabaseTypeExtensions.GetSqlForTableExists (src/Sean.Core.DbRepository/Extensions/DatabaseTypeExtensions.cs)
  • CRAP 235: DatabaseTypeExtensions.GetSqlForTableFieldExists (src/Sean.Core.DbRepository/Extensions/DatabaseTypeExtensions.cs)
  • CRAP 309: DatabaseTypeExtensions.MarkAsIdentifier (src/Sean.Core.DbRepository/Extensions/DatabaseTypeExtensions.cs)
  • CRAP 380: DbDataReaderExtensions.GetModelInternal (src/Sean.Core.DbRepository/Extensions/DbDataReaderExtensions.cs)
  • CRAP 462: DbProviderFactoryExtensions.GetDatabaseType (src/Sean.Core.DbRepository/Extensions/DbProviderFactoryExtensions.cs)
  • CRAP 552: DataRowExtensions.ToEntity (src/Sean.Core.DbRepository/Extensions/DataRowExtensions.cs)
  • CRAP 702: DbParameterExtensions.SetParameterTypeAndValue (src/Sean.Core.DbRepository/Extensions/DbParameterExtensions.cs)
  • Change coupling: DatabaseTypeExtensions.cs ↔ DbProviderFactoryExtensions.cs (src/Sean.Core.DbRepository/Extensions/DatabaseTypeExtensions.cs)
  • Change coupling: DbProviderFactoryExtensions.cs ↔ InsertableSqlBuilder.cs (src/Sean.Core.DbRepository/Extensions/DbProviderFactoryExtensions.cs)
  • Change coupling: DbProviderFactoryExtensions.cs ↔ QueryableSqlBuilder.cs (src/Sean.Core.DbRepository/Extensions/DbProviderFactoryExtensions.cs)
  • DataRowExtensions.ToEntity (cognitive 59) (src/Sean.Core.DbRepository/Extensions/DataRowExtensions.cs)
  • DataRowExtensions.ToEntity (cyclomatic 23) (src/Sean.Core.DbRepository/Extensions/DataRowExtensions.cs)
  • …and 108 more

New (231)

  • Banned license: MySql.Data
  • Banned license: MySql.Data
  • BaseSqlGenerator.ConvertFieldDefaultValue (cyclomatic 30) (src/Sean.Core.DbRepository/CodeFirst/SqlGenerator/BaseSqlGenerator.cs)
  • BaseSqlGenerator.GetCreateIndexSql (cognitive 18) (src/Sean.Core.DbRepository/CodeFirst/SqlGenerator/BaseSqlGenerator.cs)
  • CRAP 124: DatabaseTypeExtensions.GetSqlForTableExists (src/Sean.Core.DbRepository/Extensions/DatabaseTypeExtensions.cs)
  • CRAP 124: DatabaseTypeExtensions.GetSqlForTableFieldExists (src/Sean.Core.DbRepository/Extensions/DatabaseTypeExtensions.cs)
  • CRAP 161: DatabaseTypeExtensions.MarkAsIdentifier (src/Sean.Core.DbRepository/Extensions/DatabaseTypeExtensions.cs)
  • CRAP 191: DbProviderFactoryExtensions.GetDatabaseType (src/Sean.Core.DbRepository/Extensions/DbProviderFactoryExtensions.cs)
  • CRAP 56: EnumExtensions.ToSqlString (src/Sean.Core.DbRepository/Extensions/EnumExtensions.cs)
  • CRAP 74: InsertableSqlBuilder.BuildSqlCommand (src/Sean.Core.DbRepository/SqlBuilder/InsertableSqlBuilder.cs)
  • CRAP 89: QueryableSqlBuilder.BuildSqlCommand (src/Sean.Core.DbRepository/SqlBuilder/QueryableSqlBuilder.cs)
  • CRAP 96: ExpressionExtensions.GetFieldNames (src/Sean.Core.DbRepository/Extensions/ExpressionExtensions.cs)
  • Change coupling: DataRowExtensions.cs ↔ DbFactory.cs (src/Sean.Core.DbRepository/Extensions/DataRowExtensions.cs)
  • CommentedOutCode (src/Sean.Core.DbRepository/Config/MultiConnectionSettings.cs)
  • CommentedOutCode (src/Sean.Core.DbRepository/DbFirst/CodeGenerator/CodeGeneratorForPostgreSql.cs)
  • ConditionBuilder.BuildInCondition (cognitive 21) (src/Sean.Core.DbRepository/ExpressionResolve/ConditionBuilder.cs)
  • ConditionBuilder.BuildLikeOrEqualCondition (cyclomatic 16) (src/Sean.Core.DbRepository/ExpressionResolve/ConditionBuilder.cs)
  • DataRowExtensions.CreateMapper (cognitive 18) (src/Sean.Core.DbRepository/Extensions/DataRowExtensions.cs)
  • DbDataReaderExtensions.CreateModelMapper (cognitive 20) (src/Sean.Core.DbRepository/Extensions/DbDataReaderExtensions.cs)
  • DbParameterExtensions.SetParameterTypeAndValue (cognitive 18) (src/Sean.Core.DbRepository/Extensions/DbParameterExtensions.cs)
  • …and 211 more

Changes since last survey

  • 74 commits — 38 feature/other, 36 fixes

By area

  • src/Sean.Core.DbRepository — 36 commits
  • test/Sean.Core.DbRepository.Test — 19 commits
  • test/Sean.Core.DbRepository.MySqlTest — 12 commits
  • config/Common.props — 2 commits
  • (root) — 1 commit
  • examples/EntityFramework — 1 commit
  • scripts/Publish-NuGet.ps1 — 1 commit
  • src/Sean.Core.DbRepository.Dapper — 1 commit
  • src/Sean.Core.DbRepository.EntityFramework — 1 commit

Notable commits

  • fix: fix: 修复 CodeFirst 多方言 DDL 生成问题
  • fix: fix: 修复 DataReader 限量读取越界消费
  • fix: fix: 修复 IN 条件中惰性枚举值丢失问题
  • fix: fix: 修复 MySQL 升级时字段大小写误判
  • fix: fix: 修复 MySQL 表字段存在性查询的名称转义
  • fix: fix: 修复 Oracle 分页与 SQL 参数解析问题
  • fix: fix: 修复 QuestDB LIKE 模式转义
  • fix: fix: 修复 ROW_NUMBER 分页的外层字段引用
  • fix: fix: 修复 SQL 字面量格式化的文化敏感与转义问题
  • fix: fix: 修复 SQLite 元数据查询的表名单引号转义
  • fix: fix: 修复 SQLite 表字段存在性查询的名称转义
  • fix: fix: 修复可空类型、泛型实体和元组映射
  • fix: fix: 修复大范围枚举参数转换溢出
  • fix: fix: 修复实体字段映射并复用列映射
  • fix: fix: 修复批量输入重复枚举与构建状态污染
  • fix: fix: 修复泛型命令参数共享与自增主键回写
  • fix: fix: 修复表缓存复合键冲突
  • fix: fix: 修复表达式解析层的多个正确性问题
  • fix: fix: 修复连接字符串解析与配置重载
  • fix: fix: 修复连接释放与 AddOrUpdate 事务一致性问题
  • …and 54 more

Architecture

  • Unchanged — 1 containers · 1 contexts · 0 edges

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

Sean-Lu/DbRepository was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 20 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit a2e56ad43bbffeb8067e18534644496341f4ad53 — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-28e75b8e3254.