Enhance Jet SQL handling, refactor tests, and update dependencies#291
Open
ChrisJollyAU wants to merge 40 commits into
Open
Enhance Jet SQL handling, refactor tests, and update dependencies#291ChrisJollyAU wants to merge 40 commits into
ChrisJollyAU wants to merge 40 commits into
Conversation
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.
This reverts commit 6384523.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
10.0.1-servicing.REPLACE()with nullable arguments, avoiding AccessType mismatchbehaviorLongCount() > 0by rewriting toAny()string.Join(...)DateOnly.ToDateTime(...)using Jet-compatibleDateSerial/TimeSerialTesting
EFCore.Jet.FunctionalTestsin 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.