Skip to content

Intercept stored procedure return model creation#822

Closed
dsfr-be wants to merge 1 commit intosjh37:masterfrom
dsfr-be:InterceptReadStoredProcReturnObject
Closed

Intercept stored procedure return model creation#822
dsfr-be wants to merge 1 commit intosjh37:masterfrom
dsfr-be:InterceptReadStoredProcReturnObject

Conversation

@dsfr-be
Copy link
Contributor

@dsfr-be dsfr-be commented Nov 29, 2023

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 added a commit that referenced this pull request Nov 5, 2024
@sjh37
Copy link
Owner

sjh37 commented Nov 5, 2024

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

@sjh37 sjh37 closed this Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants