question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uppercase always converted to PascalCase

See original GitHub issue

Hi, we use your extension with great appreciation for some months now. Since version 2.5.1057 the reverse engineering of the database brings us problems: Multiple consecutive cases in table names as well as column names are since that version always converted to PascalCase. Because we generated our Entities project months ago (with an old version of the extension), all our Entities are named as we want. But since version 2.5.1057 (because of #1440 I guess) it is always converted to PascalCase and we don’t want that, because our code already uses the old Entity names. That would give us huge refactor work. See screenshot below for an example.

image

My suggestion would be to add an option to disable the conversion to PascalCase, because otherwise we have to refactor our whole code because of the naming problem. I do have an renaming.json that strips some prefixes like “tbl” of the table names, but adding renaming for around 1000 tables to that file is almost impossible.

I have seen #1489 and I tried with the latest daily build (2.5.1113) but it still does not work.

Provide steps to reproduce

efpt.config.json

{
    "CodeGenerationMode": 2,
    "ContextClassName": "MyDbContext",
    "ContextNamespace": null,
    "DefaultDacpacSchema": null,
    "FilterSchemas": false,
    "IncludeConnectionString": false,
    "ModelNamespace": null,
    "OutputContextPath": "Context",
    "OutputPath": "Models",
    "ProjectRootNamespace": "Entities",
    "Schemas": null,
    "SelectedHandlebarsLanguage": 0,
    "SelectedToBeGenerated": 0,
    "Tables": [//snip],
    "UiHint": "MyConnection",
    "UseBoolPropertiesWithoutDefaultSql": false,
    "UseDatabaseNames": false,
    "UseDbContextSplitting": true,
    "UseFluentApiOnly": true,
    "UseHandleBars": true,
    "UseHierarchyId": false,
    "UseInflector": true,
    "UseLegacyPluralizer": false,
    "UseManyToManyEntity": true,
    "UseNoConstructor": false,
    "UseNoDefaultConstructor": true,
    "UseNoNavigations": false,
    "UseNoObjectFilter": false,
    "UseNodaTime": false,
    "UseNullableReferences": true,
    "UseSchemaFolders": true,
    "UseSpatial": false
}

efpt.renaming.json (partial):

[{
      "ColumnPatternReplaceWith": "",
      "ColumnRegexPattern": "^(vch|bit|dtm|int|dec|nvc|sin|chr|nch)",
      "SchemaName": "dbo",
      "TablePatternReplaceWith": "",
      "TableRegexPattern": "^tbl",
      "Tables": [ ],
      "UseSchemaName": true
}]

Example SQL:

CREATE TABLE [dbo].[tblGGD](
	[vchThisIsUPPERCASE] [nvarchar](7) NULL
)

Expected output: GGD.ThisIsUPPERCASE

Provide technical details

  • EF Core version in use: EF Core 6

  • Is Handlebars used: yes C#

  • Is .dacpac used: no

  • EF Core Power Tools version: 2.5.1057+ and also tried 2.5.1113

  • Database engine: SQL Server

  • Visual Studio version: Visual Studio 2022

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ErikEJcommented, Aug 29, 2022

“PreserveCasingWithRegex”: true option added in latest daily

1reaction
ErikEJcommented, Aug 29, 2022

Is it possible to put that option in the efpt.config.json (because of version control) so that all our team members do not have to set this option manually?

Yes, I just wanted you to verify the fix first

Read more comments on GitHub >

github_iconTop Results From Across the Web

Convert underscore to PascalCase, ie UpperCamelCase
It will match any character ( . ) that comes after either the start of the string or an underscore ( (^|_) )...
Read more >
c# - How can I convert text to Pascal case?
First off, you are asking for title case and not camel-case, because in camel-case the first letter of the word is lowercase and...
Read more >
Convert String to Different Case Styles: Snake, Kebab ...
Pascal case is similar to camel case but the first letter is in uppercase. There is no space and hyphen to separate the...
Read more >
Case Converter Online
Converts words or text to any case instantly, such as lowercase, uppercase, camel case, capital case, constant case, param case, pascal case, sentence...
Read more >
Case in convert_case - Rust
Pascal case strings are lowercase, but for every word the first letter is capitalized. Boundaries: LowerUpper, DigitUpper, UpperDigit, DigitLower, LowerDigit, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found