Faithlife / FaithlifeData

Helpers for querying ADO.NET-compatible databases.
https://faithlife.github.io/FaithlifeData/
MIT License
6 stars 4 forks source link

Support for casing options on Sql.ColumnNames #41

Closed ELanning closed 3 years ago

ELanning commented 3 years ago

Sql.ColumnNames is great, but it would be nice if there were a casingKind option such that I could chose

Currently only snake_case is supported I believe?

ejball commented 3 years ago

We currently assume two things:

If distinguishing PascalCase/camelCase/nocase is important to your scenario, or the connection-wide setting for snake_case isn't sufficient, please explain.

ELanning commented 3 years ago

The connection-wide setting is sufficient, but nonoptimal for "one off" situations. Legacy systems may have a mix of some snake, some pascal, or even new projects which cannot control the tables created by some 3rd party system.

Feel free to close this, but I do think it should be considered. The fact that PascalCase, camelCase, and nocase are equivalent in SQL also reduces the issue to a boolean snake_case or non snake_case, which is nice.

ejball commented 3 years ago

Thanks for the suggestion. For what it's worth, ColumnAttribute can be used for individual columns to override the default. Clients can also "roll their own" SQL fragment generation where needed.

I do think I will close this for now, unless it becomes a high priority for someone. ColumnNames already has 6 overloads and I'd rather not double that if I can avoid it.