Skip to content

Rename function's return table column names #3403

@ChrisTorng

Description

@ChrisTorng

What problem are you trying to solve?

I have a minimal reproduction repo for this problem: ChrisTorng/PostgreSqlCitext.


I'm using 4/6/2026 2.6.1465 version of EF Core Power Tools to do Reverse Engineering.

The Edit UI can only rename the function name testtext into TestText, not supporting the returned table's column names. Even with manual editing of BeforeFix/efpt.renaming.json:

{
   "Columns": [
      {
         "Name": "resultcolumn",
         "NewName": "ResultColumn"
      }
   ],
   "Name": "testtext",
   "NewName": "TestText"
}

(it's easy now with the help of AI) to rename the returned table column, it doesn't work. The generated code in BeforeFix/TestTextModels/TestTextResult.cs:

public partial class TestTextResult
{
    public string resultcolumn { get; set; }
}

And the manual editing of BeforeFix/efpt.renaming.json will be overridden by later Edit UI, deletes the content of Columns:

{
   "Columns": [ ],
   "Name": "testtext",
   "NewName": "TestText"
}

Describe the solution you'd like

The Fixes

I've forked ErikEJ/EFCorePowerTools from chore: move sln to slnx (#3343) into my repo ChrisTorng/EFCorePowerTools. With the help of GitHub Copilot, I made some changes to make it works on my Visual Studio 2026 Insiders, easier to debug (cause I can't found other easier ways). And the fix is: Add Result class rename function. But it only works on Refresh. The manual editing of AfterFix/efpt.renaming.json doesn't survive after Edit UI.

The Results

The fixed version of EFCPT, Refreshing the AfterFix/efpt.config.json. The renaming result is in AfterFix/Models/TestTextResult.cs. The column name is now ResultColumn with [Column("resultcolumn")] attribute, instead of resultcolumn:

public partial class TestTextResult
{
    [Column("resultcolumn")]
    public string ResultColumn { get; set; }
}

No PR for original repo

Sorry it's hard for me to contribute a PR to the original repo, because of:

  1. These changes are made by GitHub Copilot mainly. I can understand some easier ones. But I can't fully understand the whole picture of EFCPT.
  2. I didn't drill down into how to unit test these changes, by EFCPT's own way.
  3. The renaming of returned table column names lacks Edit UI supports. I'm not sure whether you are willing to add this feature or not.
  4. I've changed many other files for local running/debugging. I believe these are not what you want.
  5. I'm not familiar of how GitHub/PR works.

Hope this fix helps EFCPT to support more renaming scenarios.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions