sjh37 / EntityFramework-Reverse-POCO-Code-First-Generator

EntityFramework Reverse POCO Code First Generator - Beautifully generated code that is fully customisable. This generator creates code as if you reverse engineered a database and lovingly created the code by hand. It is free to academics (you need a .edu or a .ac email address), not free for commercial use. Obtain your licence from
https://www.reversepoco.co.uk/
Other
711 stars 227 forks source link

Intercept stored procedure return model creation #822

Closed dsfr-be closed 3 weeks ago

dsfr-be commented 1 year ago

Enables to have more control regarding return model creation, especially when an error occurs during rendering.

Settings.ReadStoredProcReturnObjectException = (ex1, proc) => {
    if (ex1.Message.StartsWith("Invalid object name '#"))
    {
        proc.ReturnModels.Add(new List<DataColumn>(){new DataColumn("ReplaceTemptables")});
    }
}

This way you get notified and be able to adjust the sp or to build returnmodel yourself.

There is also ReadStoredProcReturnObjectCompleted method which can be used to create/override more complex resultsets. Which is more practical to use in some cases then the already existing Settings.StoredProcedureReturnTypes.

sjh37 commented 3 weeks ago

I have manually imported the change as this had conflicts. Thanks Frederic.