Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# NewLife.XCode 更新日志

## [Unreleased]

### Added
- 为同步内置抽取器增加可选逐页查询回调,保留默认查询和外部抽取器合同;增加 `NameFormats.Exact` 与兼容 XML 重载,显式保留物理名称大小写。
- SonnetDB 5.0.0 原生类型、元数据、分页、事务和批量语义映射;普通 NULL 读取使用下游 override,跨库迁移通过显式 `SonnetDBPackage` 保真,不向基础类加入数据库特判。

### Fixed
- SonnetDB 元数据继续识别旧 DATETIME/TIME 列,新模型仍优先使用 DATETIME2/DURATION;保留兼容类型的原生 CAST 默认值,避免反向模型重放时重复包装并产生冗余 ALTER。增加实际旧表映射和只读 DDL 计划/默认值读回回归,不修改通用数据库基类或正式 SonnetDB 5.0 依赖。

## v12.3.2026.1024 (2026-10-24)

### SonnetDB 数据库支持
Expand Down
9 changes: 9 additions & 0 deletions Doc/ProviderExtensionContracts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Optional migration and exact XML contracts

The default `DbTable` conversion may map numeric SQL NULL to a CLR default value. An ETL consumer that needs SQL NULL must be able to supply its own page reader while retaining the ID/time/offset algorithms. Set `DbPackage.QueryCallback` to read a page using the provided source, builder, offset, limit and cancellation token. The option affects `Sync` only, never ordinary DAL queries. Callers own reader disposal, SQL parameter binding, page bounds and timeout. User-supplied extractor factories and derived extractors continue to own their query path.

`PackageExtensionTests` reproduces a SQLite NULL becoming zero with the default path, and verifies an opt-in reader preserves it for each built-in algorithm. It also checks custom-source ownership and the unchanged default.

For a model with `Name="MixedName"` and `TableName="mixedname"`, the existing compact XML can omit the physical spelling even with `NameFormats.None`. Use `table.WriteXml(writer, NameFormats.Exact)` or set `EntityBuilderOption.NameFormat` to `Exact` when exporting a complete model. This keeps case-only physical mappings, without changing existing XML defaults or enum numeric values. The five-argument `ModelHelper.WriteXml` overload exposes the same opt-in for individual model members; the original four-argument method remains available for binary callers.

These extensions have no database-specific behavior. Provider overrides for ordinary session reads stay downstream; a separate Provider PR can depend on this architecture PR. Acceptance and release decisions remain with the maintainers.
113 changes: 36 additions & 77 deletions Doc/SonnetDB.md

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions HANDOFF.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## 2026-11-07 PR #105 temporal compatibility reviews

- Continuation owns only SonnetDB.cs, SonnetDBTests.cs and the corresponding documentation on codex/sonnetdb5-provider-overrides-20261106; base a224144c95865d5ae6f10c7f6db5eb8e6c816c9e. Architecture PR #104 / d53442b65dc8bf80a3b16e095fe74225f7537c55 remains unchanged and must be accepted before #105. Both trees were clean before these owned changes.
- Late reviews r4491044435/r4491044527 were still unresolved after the previous handoff. Two unchanged regression tests actually failed on the old implementation: legacy DATETIME was unmapped, and unchanged temporal defaults produced a nonempty ALTER plan. The original FAIL TRX/stdout are retained. After the Provider-only fixes both tests pass, including read-only no-ALTER plans, SetTables replay and exact default ticks/offset/Duration.
- DATETIME/TIME are secondary aliases; DATETIME2/DURATION stay first for new models. Compatible complete outer temporal CAST defaults are returned unchanged, with quoted strings/internal parentheses handled and a one-second recognition timeout. Other literals/types and ordinal string-default rules retain their existing path. No generic metadata/session/architecture or dependency change is included.
- All six XCode targets build: net45/net461/netstandard2.0/netstandard2.1/net8.0/net10.0. The final build has 856 existing repository warnings and zero errors; a new nullable-flow warning on old reference assemblies was removed using an explicit non-null/Length guard, without suppression. Final focused regression is 2/2 PASS, zero skipped. Full matched-Server suite/package journeys are separately recorded after execution, not copied from the old pr404.1 candidate.
- The fresh source-linked complete suite has now executed 66/66, zero failures/skips, with both REST/Frame variables and an owned matching public 5.0 NativeAOT Server. Its independent NuGet-only cache verifies the three SonnetDB 5.0/source844 DLLs. This is working-tree source evidence; the new committed two-package candidate and all nine package journey processes are frozen and validated separately.
- Dependencies remain official SonnetDB/Core/Protocol 5.0.0 / source84433f9e. The existing public NativeAOT Server executable was rehashed and matches 4c6cdee527f3f82c25945bbe5683cc92790e8daaf2b3b227c1b8adf2911f882e; the historical original ZIP path is currently absent and is not claimed as newly downloaded. New XCode candidates use a unique local version/source and independent caches; no package/tag/publication or production operation is authorized here.
- #404 stays OPEN until #104 then #105 are accepted/merged, matching Core/Provider packages are public, and the fully public fresh-cache journey passes. Current CI/remote source readbacks are separate from source and local package results. OIDC, iOS and s390x baseline failures must remain actual FAIL/UNKNOWN until freshly verified, not normalized to success.
- All heavy tasks are serialized by the supervising SonnetDB chat with FileShare.None lock, CPU2/single MSBuild node/no persistent service; Cordonix owns process trees. Raw commands/results/TRX and resource receipts are retained under D:/source/SonnetDB/artifacts/issue404-review-20261107/. Preserve mixed BOM/EOL and use scoped core.whitespace=cr-at-eol checks; do not perform a whole-repository EOL rewrite. Other source trees, old evidence and unmerged PR branches are retained.

# Provider extension contracts — 2026-11-06

Provider continuation: `codex/sonnetdb5-provider-overrides-20261106` depends on architecture PR #104 / `d53442b65dc8bf80a3b16e095fe74225f7537c55`. Closed #103 / f21d0c7 is preserved. Provider changes use OnFill/QueryAsync overrides and an explicit SonnetDBPackage; no database-specific base-class branches were carried forward. Source dependency is public SonnetDB/Core/Protocol 5.0.0 / 84433f9e, with matching public NativeAOT Server SHA256 4c6cdee527f3f82c25945bbe5683cc92790e8daaf2b3b227c1b8adf2911f882e.

The original 50 cases/assertions are retained with explicit migration/XML entry points. Initial new-source suite: 64/64 passed, 0 failed/skipped (50 + 10 generic + 4 NULL). Independent embedded/REST/Frame journeys passed 18 + 14 + 14 checks per protocol, with nine consumers and six actual Server starts/stops. DLL identities and hashes, fresh NuGet.org cache origins, raw TRX and failures remain in task-owned external validation evidence. Final commit/package-bound checks and PR receipts are reported separately in the Provider PR; these precommit results do not identify an already-published XCode package.

Architecture CI at d53442b65 passes all four test jobs, solution build, localization, AOT analyzer and AOT/smoke jobs except s390x NovaDb. Remaining OIDC fork-PR, iOS Xcode/workload and s390x dependency failures are separate upstream concerns; never label the whole CI green. Next: maintainers review/merge #104 before Provider acceptance; release matching NewLife.XCode and XCode.SonnetDB, then run a fully public fresh-cache consumer. SonnetDB #404 remains OPEN until that external chain closes. No formal package/tag, secret changes, EF Provider publication or production deployment is performed here.

This branch starts at upstream `512d8a434`. It responds to the architecture review in NewLifeX/NewLife.XCode#103; that closed PR remains unchanged.

- Generic, opt-in `DbPackage.QueryCallback` configures only exact built-in extractors. Custom extractor callbacks and derived extractors retain their source and `Fetch`. A missing callback preserves the original DAL query path.
- `NameFormats.Exact` and an additive `ModelHelper.WriteXml` overload retain case-only physical name mappings. Existing enum values, method signatures and default XML behavior are preserved.
- No database type checks, DbSession/DAL changes, provider dependency changes or publication belong in this architecture PR.
- SQLite-only regressions provide the minimal NULL migration and XML spelling reproductions. Validation and final commit identity are recorded in the PR; downstream Provider work depends on this branch being accepted and published with the provider.
- Validation: 10/10 SQLite/XML regressions, no failures/skips; all six XCode targets build with 859 existing-repository warnings and 0 errors; English runtime-message check passes. The upstream source has mixed LF/CRLF despite the global editorconfig: preserve original per-file bytes and use `git -c core.whitespace=cr-at-eol diff --check`, rather than mixing an EOL rewrite into the architecture change. A formatter probe and the initial zero-test discovery are retained in external validation evidence and are not test PASS claims.
- CI follow-up: the full suite may choose System.Data.SQLite while the minimal host chooses Microsoft.Data.Sqlite. The page-reader fixture now creates its connection/parameters through the actual source factory; all NULL assertions remain. Initial CI failures and this correction are recorded separately. OIDC on fork PRs, iOS Xcode/workload mismatch and s390x NovaDb failures require separate upstream workflow/dependency decisions.
4 changes: 2 additions & 2 deletions XCode.SonnetDB/XCode.SonnetDB.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
<RepositoryUrl>https://github.com/NewLifeX/NewLife.XCode</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>新生命团队;X组件;NewLife;SonnetDB;ORM</PackageTags>
<PackageReleaseNotes>新增 SonnetDB 4.0.0 官方 ADO.NET 驱动接入;支持关系表元数据、常用 CRUD、自增、分页、批量 Insert/InsertIgnore/Upsert、单主键有界删除与基本迁移;修正数值条件转换、唯一索引 Upsert、默认值与索引迁移缺陷;能力边界见 Doc/SonnetDB.md</PackageReleaseNotes>
<PackageReleaseNotes>使用 SonnetDB 5.0 官方 ADO.NET 驱动;支持精确 Decimal、DATETIME2、持久注释、长度与精度迁移、Serializable、原生 Replace、Int64 分页及复合/无主键有界删除;能力与边界见 Doc/SonnetDB.md。</PackageReleaseNotes>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>README.nuget.md</PackageReadmeFile>
</PropertyGroup>
<ItemGroup>
<Content Include="..\Doc\leaf.png" Link="leaf.png" PackagePath="\" />
<None Include="..\README.nuget.md" Pack="true" PackagePath="\" />
<PackageReference Include="SonnetDB" Version="4.0.0" />
<PackageReference Include="SonnetDB" Version="5.0.0" />
<ProjectReference Include="..\XCode\XCode.csproj" />
</ItemGroup>
</Project>
3 changes: 3 additions & 0 deletions XCode/DataAccessLayer/Common/IDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ public enum NameFormats

/// <summary>下划线</summary>
Underline,

/// <summary>保持原样,XML模型同时保留物理名称的精确大小写</summary>
Exact,
}

/// <summary>批量操作能力。Flags枚举,不同数据库支持不同批量操作</summary>
Expand Down
Loading
Loading