Skip to content

GH-5298 Lightweight saga storage honours the AddSagaType table name - #5304

Merged
jeremydmiller merged 1 commit into
mainfrom
stoat/critterwatch-1-2/wolverine-5298-saga-table-name
Oct 31, 2026
Merged

jeremydmiller merged 1 commit into
mainfrom
stoat/critterwatch-1-2/wolverine-5298-saga-table-name

Conversation

@jeremydmiller

Copy link
Copy Markdown
Member

Fixes #5298

The generated saga code goes through MessageDatabase<T>.EnrollAndFetchSagaStorage, whose schema factory path built new SagaTableDefinition(typeof(TSaga), null), discarding the table name given to AddSagaType<T>(tableName). The table was created under the registered name but reads/writes used <saga>_saga.

Fix: MessageDatabase<T> keeps the registered definitions (RegisterSagaDefinition / SagaDefinitionFor); the SQL Server, PostgreSQL, MySQL and SQLite stores register theirs in the constructor and use the lookup in SagaSchemaFor fallbacks. Oracle does not derive from MessageDatabase<T> and resolves via SagaSchemaFor using the registered definition, so it was not affected (no test added for it).

Tests: new saga_with_custom_table_name_5298 in SqlServerTests, PostgresqlTests, MySqlTests and SqliteTests runs a saga and asserts the row is in the custom table and the convention table was not created. Confirmed red on all four with the fix reverted, green with it; existing *.Sagas namespaces pass on all four. The reporter's zip was not run.

🤖 Generated with Claude Code

The generated saga code reaches the schema through MessageDatabase<T>.EnrollAndFetchSagaStorage,
which built a convention-named SagaTableDefinition and so ignored the registered table name for
SQL Server, PostgreSQL, MySQL and SQLite. The base class now remembers the registered definitions.
Oracle resolves through SagaSchemaFor directly and was not affected.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@jeremydmiller
jeremydmiller merged commit a18b020 into main Oct 31, 2026
49 checks passed
This was referenced Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When using Lightweight Saga Storage (SQL Server), the tablename defined in opts.AddSagaType<>() is not used

1 participant