question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reverse Engineer assigns wrong schema to table valued parameter from the database

See original GitHub issue

Situation: I have a stored procedure that takes a table-valued parameter as input. The stored procedure and the table-valued parameter do not share the same schema. The EF Power Tool assigns the wrong schema to the table-valued in the XXContextProcedures class.

Here is a snippet of code from the XXContextProcedures class. The error is in the schema of the type:

var parameterCategoryIDs = new SqlParameter
           {
               ParameterName = "CategoryIDs",
               Value = CategoryIDs ?? Convert.DBNull,
               SqlDbType = System.Data.SqlDbType.Structured,
               TypeName = "[supplies].[TVP_Id]",
           };

The stored procedure’s schema is [supplies], but the schema of [TVP_Id] schema is [dbo] in the database. I have to do find and replace after each time I run a reverse engineer in order to replace [supplies].[TVP_Id] with [dbo].[TVP_Id].

Otherwise, I really love the tool!

If you are unable to verify the bug I will supply SQL code to reproduce the error.

Further technical details

EF Core Power Tools version: 2.5

Database engine: Azure SQL Database

Visual Studio version: 2019 Preview version 16.9.0 Preview 1.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bhroberts52commented, Nov 28, 2020

Got it! Works now. Thanks for the hint!

0reactions
ErikEJcommented, Nov 28, 2020

Did you download the daily build? Link in release notes in the wiki…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Table valued parameter has wrong data
I had last two columns switched in SQL table type and when the DataTable object arrived to the procedure, it disregarded column names...
Read more >
Table-Valued Parameters in SQL Server
Table -Valued Parameters aka TVPs are commonly used to pass a table as a parameter into stored procedures or functions. They are helpful...
Read more >
Reverse Engineering and Schema/Owner-Assignment
Hello Toad Team, i'am using the button “reverse engineering” to create a model from a mysql-5.1 database with the default settings from the ......
Read more >
Ten Common Database Design Mistakes - Simple Talk
First, if a newbie writes ratty code (like using a cursor to go row by row through an entire ten million row table...
Read more >
Breaking changes in EF Core 6.0
Scaffolding (reverse engineering) a DbContext and entity types from an existing database always explicitly mapped join tables to join entity ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found