ErikEJ / EFCorePowerTools

Entity Framework Core Power Tools - reverse engineering, migrations and model visualization in Visual Studio & CLI
MIT License
2.19k stars 298 forks source link

Reverse Engineering Store Procedures and Functions are not use proper identifiers #2623

Open BillDuffy1956 opened 3 days ago

BillDuffy1956 commented 3 days ago

The organization I'm working with uses Stored Procedures and Functions to produce table-like results. However, EF Tools Reverse Engineering does not perform the same property name conversions it does on the table from the same database. This produces a discordance in the look & style of code, which hurts my brain.

e.g. (shortened for brevity)

CREATE PROCEDURE [dbo].[sp_SEC_ClientsForUser] 
AS
BEGIN
    SET NOCOUNT ON;
SELECT * FROM (
      SELECT  DISTINCT C.name, C.client_id FROM client C    
    ) TheList 
ORDER BY 1
END

results in no PascalCase nor _'s removed:

    public partial class sp_SEC_ClientsForUserResult
    {
        public string name { get; set; } = default!;
        public int client_id { get; set; }
    }

I would like to see the usual conversions done as in tables, thus:

    public partial class spSecClientsForUserResult
    {
        public string Name { get; set; } = default!;
        public int ClientId { get; set; }
    }
ErikEJ commented 2 days ago

I could investigate the possibility of adding an option for this, and possibly even making it the default behaviour.

You result set classes will then be decorated with [Column()] attributes - hope you will be OK with that?

BillDuffy commented 2 days ago

I would be delighted. Thanks.

ErikEJ commented 2 days ago

If you like my free tools, I would be very grateful for a rating/review on Visual Studio Marketplace and/or a one-time or monthly sponsorship