Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Enhancements to Query Management and Consistency in SQL Queries #297

Merged
merged 8 commits into from
Dec 23, 2023

Conversation

AlmarAubel
Copy link
Contributor

Title: Enhancements to Query Management and Consistency in SQL Queries

Hello,

I've made several improvements to the codebase, focusing on enhancing readability and consistency across all SQL queries. Below is a detailed breakdown of the changes:

  1. Adoption of C# Raw String Literals: Utilizing the new Raw string literal feature introduced in C# 11, I've refactored the queries for improved readability and reduced complexity. This feature allows for multi-line strings without the need for escape characters, making the SQL queries more readable and maintainable.

  2. Dynamic Alias Names in SQL Queries: Wherever alias names in SQL queries were hard-coded, I have updated them to dynamically derive from the DTO property names. This ensures better alignment between the database layer and the data transfer objects, enhancing code consistency and reducing the risk of errors during refactoring or property name changes.

  3. Partial Refactor of Update Queries: I've rewritten a portion of the update queries to i clarity. The remaining update queries will be addressed in a subsequent PR.

  4. I have moved all queries into their own constant strings. This change streamlines the code structure.

The primary goal of these changes is to increase the readability and consistency of the SQL queries throughout the entire codebase. This should aid future development and maintenance efforts.

Looking forward to your feedback and suggestions.

@kgrzybek
Copy link
Owner

  1. Adoption of C# Raw String Literals: Utilizing the new Raw string literal feature introduced in C# 11, I've refactored the queries for improved readability and reduced complexity. This feature allows for multi-line strings without the need for escape characters, making the SQL queries more readable and maintainable.

I like it and I agree - it is more readable and maintainable

  1. Dynamic Alias Names in SQL Queries: Wherever alias names in SQL queries were hard-coded, I have updated them to dynamically derive from the DTO property names. This ensures better alignment between the database layer and the data transfer objects, enhancing code consistency and reducing the risk of errors during refactoring or property name changes.

Yes, there were places without that and this is important because of reasons you mentioned.

  1. Partial Refactor of Update Queries: I've rewritten a portion of the update queries to i clarity. The remaining update queries will be addressed in a subsequent PR.

Ok

  1. I have moved all queries into their own constant strings. This change streamlines the code structure.

Yep, if something can a be constant it should be.

To sum up - everything is ok, thanks for another great change - I am merging :)

@kgrzybek kgrzybek merged commit 7bf832a into kgrzybek:master Dec 23, 2023
2 checks passed
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.

None yet

2 participants