ErikEJ / EFCorePowerTools

Entity Framework Core Power Tools - reverse engineering, migrations and model visualization in Visual Studio & CLI
MIT License
2.12k stars 293 forks source link

Stored Procedure not working #925

Closed GearTheWorld closed 3 years ago

GearTheWorld commented 3 years ago

Describe what is not working as expected.

Steps to reproduce I just try to add a stored procedure and despite having a message of success I have nothing, no function import, no complex type. I don't know what I'm doing wrong. I attached my Stored Procedure and the config file

Files.zip

EF Core Power Tools Version Version 2.5.612.0 SQLite ADO.NET Provider included: 1.0.109.0 SQLite EF6 DbProvider in GAC - No System.Data.SQLite DDEX provider - No SQLite Simple DDEX provider - Yes

Database engine: (SQlite, SQL Compact, SQL Server, Postgres) SQL Server 2016

Visual Studio version: (e.g. Visual Studio 2019 16.8) Microsoft Visual Studio Professional 2019 Version 16.9.4 VisualStudio.16.Release/16.9.4+31205.134 Microsoft .NET Framework Version 4.8.04084

ErikEJ commented 3 years ago

Have you checked the output window for errors?

GearTheWorld commented 3 years ago

The output window shows nothing

GearTheWorld commented 3 years ago

There's something written about the SP in the config files


      {
         "Name": "[dbo].[GetShipments]",
         "ObjectType": 1
      }
ErikEJ commented 3 years ago

Are you able to generate other stored procedures from the same database?

Can you run: sp_describe_first_result_set against it?

GearTheWorld commented 3 years ago

I ran the script and it generates the data beautifully with everything described correctly

image

ErikEJ commented 3 years ago

Could you share your generated code, I cannot implement the stored procedure without the referenced tables

GearTheWorld commented 3 years ago

What do you mean by generated code?

ErikEJ commented 3 years ago

The code generated by power Tools.

GearTheWorld commented 3 years ago

Sadly, it generates nothing

GearTheWorld commented 3 years ago

I can give you a video of what is going on if you want

ErikEJ commented 3 years ago

What makes you think no code is generated? I prefer a repo project / schema

GearTheWorld commented 3 years ago

Ok let me prepare you a repo. Hold on

GearTheWorld commented 3 years ago

Here it is. In the main project, you have a folder called Files in which I added the entire database script and the project CubiDataStore is the one to use the EF Core Power Tool

Hope this helps RepoForErik.zip

ErikEJ commented 3 years ago

Yes, that helped, the stored procedures depend on a DbContext, and you have selected to only generate Entity Types!

You need to refactor your "DataStore.cs" so at least some parts of it is generated by EF Core Power Tools!

GearTheWorld commented 3 years ago

Thank you Erik

GearTheWorld commented 3 years ago

Finally, my DataStore.cs is useless. I removed it and now I'm using the tool to generates the ApplicationDbContext

ErikEJ commented 3 years ago

I will log an error if sprocs or functions are selected when generating entities only.