-
-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to reverse engineer stored procedures using temp tables. #539
Comments
I am using sp_describe_first_result_set to discover metadata, and it does not support temp tables, so this is sadly by design. |
Please check https://github.com/DarioN1/SPToCore. It can generate stored procedure mapping even if an SP uses temp table or contains dynamic code. |
@tiomny I see, so you suggest just logging and then ignoring errors callings sp_describe_first_result_set ? |
That might be the parameter IgnoreDescribeResultSetError. |
I cannot see that anywhere, could you please link to it? |
I suggest you to introduce this parameter and corresponding functionality. |
I think it may make more sense to just ignore and log the failed attempt to get the result set? |
That would work for me perfectly. |
Fixed in latest daily build |
sorry to bother but I'm getting the same error with the following configuration: |
There is no fix, but an empty result class is created, and you can manually add the properties. |
This is a HUGE issue. We hope for a solution either by Microsoft or by Erik ! I tried all the imaginable possibilities even declaring variables and adding the values of the select into the variables and doing a SELECT of these variables at the end |
@GearTheWorld If the solutions proposed above do not work for you, please create a new issue with FULL repro information, and I will have a look. |
To help myself in the future when I hit this problem again, here's the solution for creating the proper .NET result type during reverse engineering, when you actually want that type to be correctly created: create procedure procs.MyProc
as
begin
-- workaround for ef core: define result type explicitly
if not exists(select sessionproperty('fmtonly'))
begin
set fmtonly off; -- <-- This is the key!
select top (0)
0 as PropInt,
'' as PropString,
cast(0 as bit) as PropBool;
return;
end
-- create temporary table
create table #myTemp (
-- columns here
);
-- more code
end |
@0liver Thanks - I will add a link to this in the docs |
Perhaps this is a known issue, and in that case apologies... It would be nice to have the ability to reverse engineer stored procedures that create and use temp tables. When I Reverse Engineer a database with stored procedures that include a temp table, the extension throws an error:
Steps to reproduce
Further technical details
EF Core Power Tools version: 2.4.236.0
Database engine: SQL Server
Visual Studio version: VS2019 16.7.5
The text was updated successfully, but these errors were encountered: