Allow treating links references as binary data #511
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
Implements issue #508 to allow treating links references as binary data, enabling the doublets store to function as a file system, archive, or file storage database.
Changes
1. New Extension Methods (ILinksExtensions.cs)
Added
EnsureReferenceExistsOrExternalmethods that validate references while allowing external (binary data) references:Behavior:
2. New Decorator: LinksExternalReferenceValidator
Created
LinksExternalReferenceValidator<TLinkAddress>decorator that:Each(),Update(), andDelete()methodsEnsureReferenceExistsOrExternal()for validationLocation:
csharp/Platform.Data.Doublets/Decorators/LinksExternalReferenceValidator.cs3. Comprehensive Test Suite
Added 7 tests in
LinksExternalReferenceValidatorTests.cs(all passing ✅):Key Features
External Reference Support via Hybrid Type
Uses
Hybrid<T>withisExternal: trueto mark references as binary data:Use Cases Enabled
Testing
Local Tests: ✅ All 7 tests passing
CI Status: ✅ Passing (auto-merge workflow succeeded)
Implementation Details
Validation Logic
Decorator Pattern
Follows existing pattern from
LinksInnerReferenceExistenceValidator:LinksDecoratorBase<TLinkAddress>ILinks<TLinkAddress>implementationBackwards Compatibility
✅ Fully backwards compatible
LinksInnerReferenceExistenceValidatorcontinues to workLinksExternalReferenceValidatoris opt-inRelated
LinksInnerReferenceExistenceValidator.cs(lines 10 and 80)🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com