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.

Entities are not converted to pascal case when all tables are renamed using json config

See original GitHub issue

First of all, thanks for the brilliant tool. it works quite well.

All of my tables have name in capital letter, separated by “_” for example

  • PREFIX_PURPOSE_SUMMARY
  • PREFIX_ANOTHER_PURPOSE_SUMMARY

If I use the PowerTool or EF core scaffold without .renaming.json then it converts all DBSet names in pascal case correctly as below

  • PrefixPurposeSummary
  • PrefixAnotherPurposeSummary

Since all of my tables have same prefix (don’t ask me why), I want the generated entities to not have this prefix, so I used .renaming.json with following config

[
  {
    "SchemaName": "SchemaName",
    "UseSchemaName": false,
    "TablePatternReplaceWith": "",
    "TableRegexPattern": "((^PREFIX)?([ _,]+))"
  }
]

This works, and I get the entities generated without the prefix (great!), however the resultant entity names are not converted into PascalCase, so my generated entities now look as below

  • PURPOSESUMMARY
  • ANOTHERPURPOSESUMMARY

In summary, pascal casing is not applied if table pattern replacement is used with regex. It looks like, this is a minor change in the code, I am happy to submit pull request if you want, however please let me know if I have got the configuration wrong?

Provide technical details

  • EF Core version in use: EF Core 6

  • Is Handlebars used: no

  • Is .dacpac used: no

  • EF Core Power Tools version: 2.5.1007.0

  • Database engine: Oracle

  • Visual Studio version: Visual Studio 2019

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:14 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
osellycommented, Jul 19, 2022

You should be able to override by adding a renamer for the affected tables where name and newname are the same.

Sorted thanks for the speedy reply. Previously posted json would change to be the following for anyone else who stumbles across this having the same issue.

{ “ColumnPatternReplaceWith”: “”, “ColumnRegexPattern”: “^(tbl)”, “SchemaName”: “SchemaName”, “TablePatternReplaceWith”: “”, “TableRegexPattern”: “^(tbl)”, “Tables”: [ { “Columns”: [ ], “Name”: “tblSIMCard”, “NewName”: “SIMCard” } ], “UseSchemaName”: false }

0reactions
ErikEJcommented, Jul 19, 2022

You should be able to override by adding a renamer for the affected tables where name and newname are the same.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Convert entity property camel case to snake case in json ...
In my entity class properties are named with camel case. So when I create a rest service it gives me json, where the...
Read more >
How to customize property names and values with System. ...
Implement a custom property naming policy; Convert dictionary keys to camel case; Convert enums to strings and camel case; Configure the order ...
Read more >
Customising ASP.NET Core Identity EF Core naming ...
In this post I'll describe how to configure EF Core to use snake_case for database object names instead of Camel Case, so they...
Read more >
Deserialize Snake Case to Camel Case With Jackson
In this article, we've seen different ways to deserialize snake case JSON to camel case fields using Jackson. First, we explicitly named the ......
Read more >
Entity Framework Core plugin to apply naming conventions ...
Entity Framework Core plugin to apply naming conventions to table and column names (e.g. ... converted to lower-case - and all those quotes...
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