C# Views - Use Name from ViewAttribute instead of Method Name#3792
Merged
joshua-spacetime merged 4 commits intoclockworklabs:masterfrom Dec 2, 2025
Merged
C# Views - Use Name from ViewAttribute instead of Method Name#3792joshua-spacetime merged 4 commits intoclockworklabs:masterfrom
joshua-spacetime merged 4 commits intoclockworklabs:masterfrom
Conversation
Collaborator
|
Thank you for creating this! We'll work on getting it reviewed. |
rekhoff
approved these changes
Dec 1, 2025
Contributor
rekhoff
left a comment
There was a problem hiding this comment.
Good find, changes are very strait forward. I've updated the Snapshots to reflect the change. Approved
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.
C# Views - Use Name from ViewAttribute instead of Method Name
Description of Changes
The documentation for C# views says that "Views must be declared as Public, with an explicit Name, and [...]". However, the
Nameprovided to theViewattribute is not being used as the name of the view in the Module or the generated C# client SDK code. TheViewDeclarationactually checks that theViewattribute's name is not null or empty, but then proceeds to do nothing with it.This PR updates the
ViewDeclarationto use theNameproperty fromViewAttribute.For more info - see my bug report in Discord: https://discord.com/channels/1037340874172014652/1443881580602069043
API and ABI breaking changes
No breaking change to the API. Though, anyone who has a view name declared that's different from their method name will have to deal with that during migration of their modules.
Expected complexity level and risk
1 - Trivial change
Testing
I compiled the C# projects under
crates/bindings-csharp, built the NuGet packages, and tested them locally with a project using SpacetimeDB 1.10 (CLI and associated packages).I confirmed that the generated classes now use the value from the
Viewattribute as theRemoteTableName. See attached image.