Skip to content

Enhance Jet SQL handling, refactor tests, and update dependencies#291

Open
ChrisJollyAU wants to merge 40 commits into
CirrusRedOrg:masterfrom
ChrisJollyAU:paramtest
Open

Enhance Jet SQL handling, refactor tests, and update dependencies#291
ChrisJollyAU wants to merge 40 commits into
CirrusRedOrg:masterfrom
ChrisJollyAU:paramtest

Conversation

@ChrisJollyAU

@ChrisJollyAU ChrisJollyAU commented Jun 30, 2026

Copy link
Copy Markdown
Member

Summary

This PR brings the Jet provider forward for the 10.0.1 servicing line, with a mix of Jet/ACE SQL fixes, compiled-model support work, connection-string robustness, dependency updates, and functional-test maintenance.

A large part of the diff is generated compiled-model baseline output; the main hand-written changes are concentrated in provider SQL generation, type mappings, scaffolding/runtime annotations, data-layer connection handling, and CI/test cleanup.

Notable changes

  • Updates .NET, EF Core, Microsoft library, test SDK, SourceLink, MSTest, and coverage dependencies for the 10.0.9 / SDK 10.0.300 stack.
  • Bumps the package version metadata to 10.0.1-servicing.
  • Improves Jet SQL generation for:
    • mixed explicit joins and cross joins by grouping Jet join output correctly
    • REPLACE() with nullable arguments, avoiding Access Type mismatch behavior
    • LongCount() > 0 by rewriting to Any()
    • string.Join(...)
    • DateOnly.ToDateTime(...) using Jet-compatible DateSerial/TimeSerial
    • boolean/numeric conversion and null handling cases
  • Adds compiled-model support pieces for Jet annotations, including runtime annotation generation and many new scaffolding baselines.
  • Improves identity seed/increment propagation for scaffolding and compiled/runtime model scenarios.
  • Refines Jet type mappings, including default mapping instances, long/integer handling, GUID handling, date/time/time-span mappings, and escaped identifier generation.
  • Refactors Jet connection-string normalization so ODBC/OLE DB provider and data-source values are rebuilt more safely, including preserving native ODBC driver braces.
  • Tightens data-layer resource handling around split commands, schema readers, cloned commands, cloned connections, and GUID reads.
  • Removes or trims functional tests for unsupported Jet/Access features such as JSON and primitive collection scenarios.
  • Updates expected functional-test baselines and green-test tracking.
  • Splits functional tests in CI into Query and Non-Query shards, then merges TRX output for green-test comparison.
  • Adds repository guidance files for AI coding assistants.

Testing

  • Updated and regenerated functional-test expectations and compiled-model baselines.
  • Added/updated targeted tests for connection-string normalization, compiled models, identity annotations, query translation, and Jet-specific SQL behavior.
  • CI workflow now runs EFCore.Jet.FunctionalTests in Query and Non-Query shards and merges the results before comparing established green tests.

Notes for reviewers

The biggest apparent line-count increase is generated compiled-model baseline code. The provider behavior changes to review most closely are in Jet SQL generation, type mapping defaults, runtime/scaffolding annotation handling, and connection-string normalization.

Enhance translation of string functions for Jet provider:
- Add CASE handling for MID index -1 in JetStringMethodTranslator
- Implement string.Join(string, string[]) translation via concatenation
- Update tests for new SQL logic
Refactored F1JetFixture to use a custom value converter and comparer for List<byte> as row version. Extended OptimisticConcurrencyJetTest to cover TPH, TPT, and TPC mappings with List<byte> row versions. Removed F1ULongJetFixture and improved test clarity and coverage for custom concurrency token types.
Remove ComplexJson, OwnedJson, OwnedTableSplittingPrimitiveCollection as would never work
BasicTypesQueryJetFixture: Update the expected value for DateTimeOffset to be utc
Scaffolding tests: Add Compiled model test and its baselines
Introduce JetCSharpRuntimeAnnotationCodeGenerator for design-time annotation support and register it in JetDesignTimeServices. Remove explicit EF Core package versions from the project file. Comment out default "bigint" mapping to match Jet/ACE support. Add copilot-instructions.md with provider-specific guidelines.
Updated Version.props to set VersionPrefix to 10.0.1 and PreReleaseVersionLabel to "servicing", marking the transition from the initial release to a servicing (maintenance/bugfix) release.
Refactor JetQuerySqlGenerator to correctly translate boolean-to-numeric conversions for Microsoft Access/Jet/ACE, multiplying boolean operands by -1 before conversion (e.g., CBOOL(expr * -1)), and clarify nullability handling. Update tests to match new SQL output and add coverage for SUM over boolean columns. Removes SQL Server-specific constructs for better Jet/ACE compliance.
Adjusted test expectations for IdentitySeed and IdentityIncrement values in Cats and Dogs tables to match new defaults (Cats: 1/2, Dogs: 2/2). Reflects changes in Jet/Access identity column configuration.
The Default property in JetTimeSpanTypeMapping now uses "datetime" as the store type instead of "time", aligning TimeSpan mapping with Jet/Access database conventions.
Changed the mapping for "long" in JetTypeMappingSource from _bigint to _integer, ensuring "long" is treated as an integer type in Jet/Access SQL. This aligns with Jet/ACE SQL type compatibility.
Skip 64-bit enum HasFlag tests due to Jet/ACE limitations with bigint/decimal bitwise operations. Switch tests to use short and byte enums instead. Update expected SQL to use Jet/ACE BAND operator and identifier quoting.
We used to use named parameters for OLE DB. It mostly worked fine but found a single exception in the test Navs_query. On such a deeply nested query and specifically where you have multiple LIKE clauses that uses the same parameter in different scopes, the jet/ace provider can rewrite/optimize the query before the parameter binding happens. So navs_query the order of the parameters is not string,string,numeric,string aka in the order of the sql left to right. It is actually string,numeric,string,string. Or even just string,numeric and we dont pass any duplicate parameters in. Official documentation says oledb only supports the ? placeholder and positional parameters - like odbc. So we just switch to using the positional parameters for both odbc and oledb
Added CLAUDE.md to provide detailed onboarding and reference documentation for Claude Code (claude.ai/code) and contributors. The file outlines project purpose, build and test instructions, project structure, architecture, Jet SQL constraints, and versioning policies for EntityFrameworkCore.Jet.
Refactor JetCommand and related classes for better disposal of resources and command splitting.
Refactored GetGuid to handle DBNull, byte[], and string values safely, returning Guid.Empty when configured. Updated GetFieldValue<T> to use GetGuid for Guid types, ensuring consistent and reliable GUID retrieval from the data reader.
Added AGENTS.md with project and agent guidance. Refactored JetLiftOrderByPostprocessor.Visit for clarity. Removed unused using in JetDataReader.cs. Marked collation-related migration tests as skipped and updated expected SQL output, since Jet does not support collation.
Refactored JetQuerySqlGenerator to properly group and parenthesize tables and joins, ensuring Jet/Access-compliant SQL when mixing cross joins, inner joins, and subqueries. Added helper methods for join grouping and alias extraction. Updated Northwind test assertions to match new Jet-style SQL output, improving compatibility and correctness. Minor refactoring of nullable numeric and type conversion handling.
EFCore.Jet.FunctionalTests are now split into two shards (Query and Non-Query) in both pull_request.yml and push.yml workflows. Each shard runs independently with its own results directory and up to three retries on crash. Test results from both shards are merged for reporting and comparison, ensuring accurate tracking of passing tests across all shards.
Refine JetPropertyExtensions to improve value generation strategy selection, add an extension for property overrides, and clarify handling of shared table roots and FKs. Reformat OnModelCreating in GraphUpdatesJetTestBase for consistency, and update SeedAsync to better document and adjust composite FK constraint drops for Jet's MATCH FULL semantics.
Introduce JetQueryTranslationPreprocessor and factory to rewrite LongCount() > 0 as Any(), ensuring Jet/Access SQL compatibility. Update DI registration and test assertions to use EXISTS instead of COUNT_BIG.
Wrap REPLACE calls with IIF to ensure NULL propagation when any argument is NULL, preventing "Type mismatch" errors in Access. Substitute safe placeholders for NULL arguments to avoid runtime errors. Update tests to match new SQL output.
Add runtime checks for identity seed/increment on compiled models, update annotation retrieval to avoid table-specific overloads for RuntimeProperty, and ensure complex type properties are annotated with ValueGenerationStrategy.None. Improve type mapping logic and set EF_TEST_REWRITE_BASELINES to 0 in test.runsettings.
Refactor JetConnection to use JetConnectionStringBuilder directly for Jet/ACE-specific logic and simplify provider property access. Add ValidateDatabaseFileExtension to restrict deletions to .accdb/.mdb files. Improve identifier escaping to handle backticks. Add test to ensure extra connection string keywords are preserved. Minor formatting fixes.
- Bump .NET, EFCore, and Microsoft libs to 10.0.9
- Update Microsoft.NET.Test.Sdk to 18.7.0 and Build.Tasks.Core to 18.7.1
- Refactor JetConnection for robust ODBC/OLE DB string handling
- Add test to ensure ODBC driver braces are preserved
- Use default Microsoft.EntityFrameworkCore.Relational version in integration tests
@ChrisJollyAU ChrisJollyAU self-assigned this Jun 30, 2026
@ChrisJollyAU ChrisJollyAU requested a review from a team as a code owner June 30, 2026 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant