Skip to content

Conversation

crwells
Copy link

@crwells crwells commented Sep 4, 2025

Motivation and Context (Why the change? What's the scenario?)

Reading the SQL in these two classes is very difficult, and there is a lot of repetitive code in each method.

Example of previous SQL block:

        var queryColumns = $"{this.GetFullTableName(this._config.MemoryTableName)}.[id]," +
                           $"{this.GetFullTableName(this._config.MemoryTableName)}.[key]," +
                           $"{this.GetFullTableName(this._config.MemoryTableName)}.[payload]," +
                           $"{this.GetFullTableName(this._config.MemoryTableName)}.[tags]";

Now becomes

        var memoryTable = this.GetFullTableName(this._config.MemoryTableName);

        var queryColumns = $"{memoryTable}.[id]," +
                           $"{memoryTable}.[key]," +
                           $"{memoryTable}.[payload]," +
                           $"{memoryTable}.[tags]";

The important part of the code (generating a SQL statement) no longer gets washed out by the repetitive, unimportant code.

High level description (Approach, Design)

This changes generates the table names at the beginning of each method and then uses them in constructing the queries. This improves readability, and makes it easier to make changes in the future.

@crwells crwells requested a review from dluc as a code owner September 4, 2025 15:34
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.

1 participant