mirror of
https://github.com/clockworklabs/SpacetimeDB.git
synced 2026-05-14 03:37:55 -04:00
62e79fad95
C# Views - Use Name from ViewAttribute instead of Method Name # Description of Changes The [documentation for C# views](https://spacetimedb.com/docs/modules/c-sharp#views) says that "Views must be declared as Public, **with an explicit Name**, and [...]". However, the `Name` provided to the `View` attribute is not being used as the name of the view in the Module or the generated C# client SDK code. The `ViewDeclaration` actually checks that the `View` attribute's name is not null or empty, but then proceeds to do nothing with it. This PR updates the `ViewDeclaration` to use the `Name` property from `ViewAttribute`. 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 `View` attribute as the `RemoteTableName`. See attached image. <img width="1429" height="372" alt="Screenshot 2025-11-28 at 3 04 48 PM" src="https://github.com/user-attachments/assets/1db83c14-b0dc-4bcb-87ac-50e104f4d501" /> --------- Co-authored-by: rekhoff <r.ekhoff@clockworklabs.io> Co-authored-by: joshua-spacetime <josh@clockworklabs.io>