Skip to content

Conversation

@ondrejtucny
Copy link

Description

Introduced IdentifierCasing option enabling upper / lower / pascal-casing of all identifiers in ScriptWriter. Resolves #177.

SqlScriptGeneratorOptions now supports a new setting IdentifierCasing with the following options:

  • PreserveOriginal — outputs identifiers as-is; this is the default behavior corresponding to the current state (no breaking change)
  • Lowercase — lower-case all identifiers when producing the output
  • Uppercase — upper-case all identifiers when producing the output
  • PascalCase — first character upper, remaining lower

Added unit tests for the various options, including compatibility with KeywordCasing property and ensuring the default state.

Code Changes

…sing of all identifiers in ScriptWriter

SqlScriptGeneratorOptions now supports a new setting IdentifierCasing with the following options:
- PreserveOriginal — outputs identifiers as-is; this is the default behavior corresponding to the current state (no breaking change)
- Lowercase — lower-case all identifiers when producing the output
- Uppercase — upper-case all identifiers when producing the output
- PascalCase — first character upper, remaining lower

Added unit tests for the various options, including compatibility with KeywordCasing property and ensuring the default state.
@ondrejtucny ondrejtucny changed the title Dev/ondrejtucny/issue 177 IdentifierCasing option enabling upper / lower / pascal-casing of all identifiers in ScriptWriter Oct 27, 2025
@ondrejtucny
Copy link
Author

@microsoft-github-policy-service agree company="BoldBrick"

@clement911
Copy link

But wouldn't that be dangerous to change the casing of identifiers if they depend on the collation used by the containing DB?

@ondrejtucny
Copy link
Author

But wouldn't that be dangerous to change the casing of identifiers if they depend on the collation used by the containing DB?

This is up to the caller (user of ScriptWriter) to decide. Plus, the default is PreserveOriginal. There are cases where canonical normalization of source code is necessary.

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.

Option to normalize casing of identifiers in the ScriptGenerator

2 participants