Add full suite of interfaces to SequentialGuid & SequentialSqlGuid structs#19
Merged
buvinghausen merged 10 commits intomasterfrom Mar 21, 2026
Merged
Add full suite of interfaces to SequentialGuid & SequentialSqlGuid structs#19buvinghausen merged 10 commits intomasterfrom
buvinghausen merged 10 commits intomasterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR promotes SequentialGuid and SequentialSqlGuid to richer, BCL-integrated value types by introducing a shared ISequentialGuid<TSelf> contract, adding parsing/formatting APIs across TFMs, adding comparison operators, and updating/readjusting README packaging and documentation across the repo.
Changes:
- Add
ISequentialGuid<TSelf>with conditional formatting/parsing interface inheritance and (net7+)static abstract Create(Guid). - Implement comparable/equatable/formattable/parsable members, comparison operators, and implicit conversions on
SequentialGuid/SequentialSqlGuid. - Add new per-package READMEs, update root README, and change packing to include project-local
README.mdin NuGet packages.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/SequentialGuid/ISequentialGuid.cs |
Introduces shared interface contract with TFM-conditional interface inheritance and factory. |
src/SequentialGuid/SequentialGuid.cs |
Adds interface implementations, operators, implicit conversions, and parse/format APIs. |
src/SequentialGuid/SequentialSqlGuid.cs |
Adds interface implementations, operators, implicit conversions, and parse/format APIs for SQL-byte-order wrapper. |
test/SequentialGuid.Tests/SequentialGuidStructTests.cs |
Adds tests for Parse/TryParse and span formatting/parsing across TFMs. |
test/SequentialGuid.Tests/SequentialSqlGuidStructTests.cs |
Adds tests for Parse/TryParse and span formatting/parsing across TFMs. |
src/SequentialGuid/README.md |
Adds a full package README including new wrapper documentation. |
src/SequentialGuid.EntityFrameworkCore/README.md |
Adds per-package README for EF Core integration. |
src/SequentialGuid.MongoDB/README.md |
Adds per-package README for MongoDB integration. |
src/SequentialGuid.NodaTime/README.md |
Adds per-package README for NodaTime integration. |
src/Directory.Build.props |
Switches NuGet README packing to use project-local README.md. |
README.md |
Reworks root README into repo landing page with package index and summaries. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Add interface implementations and implicit operators to
SequentialGuid/SequentialSqlGuidSummary
This PR promotes
SequentialGuidandSequentialSqlGuidfrom simple wrapper structs to first-class .NET citizens by implementing the standard BCL interfaces and adding implicit conversion operators. A sharedISequentialGuid<TSelf>interface captures the common contract.New:
ISequentialGuid<TSelf>interfaceDefines the shape shared by both struct types, constraining
TSelf : struct, ISequentialGuid<TSelf>:IFormattable,IComparable,IComparable<TSelf>,IEquatable<TSelf>ISpanFormattable,ISpanParsable<TSelf>IUtf8SpanFormattable,IUtf8SpanParsable<TSelf>A
static abstract Create(Guid)factory method (available on .NET 7+) allows generic code to construct either type from a rawGuid.Interface implementations on both structs
IComparableCompareTo(object?)IComparable<TSelf>CompareTo(TSelf)IEquatable<TSelf>Equals(TSelf)— plusGetHashCode()overrideIFormattableToString(string?, IFormatProvider?)ISpanFormattable(.NET 6+)TryFormat(Span<char>, out int, ReadOnlySpan<char>, IFormatProvider?)IParsable<TSelf>(.NET 7+)Parse(string, IFormatProvider?),TryParse(string?, IFormatProvider?, out TSelf)ISpanParsable<TSelf>(.NET 7+)Parse(ReadOnlySpan<char>, IFormatProvider?),TryParse(ReadOnlySpan<char>, IFormatProvider?, out TSelf)IUtf8SpanFormattable(.NET 10+)TryFormat(Span<byte>, out int, ReadOnlySpan<char>, IFormatProvider?)IUtf8SpanParsable<TSelf>(.NET 10+)Parse(ReadOnlySpan<byte>, IFormatProvider?),TryParse(ReadOnlySpan<byte>, IFormatProvider?, out TSelf)Comparison operators
Both structs now define
<,<=,>,>=operators delegating toCompareTo.Implicit conversion operators
SequentialGuid↔GuidSequentialGuid↔stringSequentialSqlGuid↔GuidSequentialSqlGuid↔stringUpdated README
Each package-level README now documents the struct wrappers. A new top-level
README.mdserves as the repository landing page with CI/NuGet badges and per-package summaries, while each project folder contains its own README packed into the NuGet package.