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
705 stars 231 forks source link

Intercept stored procedure return model creation #822

Open dsfr-be opened 10 months ago

dsfr-be commented 10 months 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.