IdentifierCasing option enabling upper / lower / pascal-casing of all identifiers in ScriptWriter
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
- [x] Unit tests are added, if possible
- [x] Existing tests are passing
- [x] New or updated code follows the guidelines here
@microsoft-github-policy-service agree company="BoldBrick"
But wouldn't that be dangerous to change the casing of identifiers if they depend on the collation used by the containing DB?
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.