ErikEJ/EFCorePowerTools

Can't reverse engineer functions from dacpac

Closed this issue ยท 9 comments

Hi, I ran into a strange problem when reverse engineering functions from dacpac file. To repro, I created brand new SQL Server Database project in Visual Studio 2022. I then added simple table and a default table valued function as follows:

CREATE FUNCTION [dbo].[Function1]
(
	@param1 int,
	@param2 char(5)
)
RETURNS @returntable TABLE
(
	c1 int,
	c2 char(5)
)
AS
BEGIN
	INSERT @returntable
	SELECT @param1, @param2
	RETURN
END

When I try to reverse engineer the resulting dacpac, I don't see any function listed:

image

However, if I deploy the database project to SQL server and try to reverse engineer from that, functions are listed.
Before I start digging into source code and try to identify the issue, is there something obvious that I'm missing? Thanks.

Provide steps to reproduce a bug

  • Create new SQL Server Database project in Visual Studio 2022
  • Add default table valued function
  • Try to reverse engineer the dacpac

Provide technical details

  • EF Core Power Tools version: 2.6.420

  • Exact Visual Studio version: Visual Studio 2022 17.10.6

  • Database engine: SQL Server

  • EF Core version in use: EF Core 8

  • Is Handlebars templates used: no

  • Is T4 templates used: no

  • Is a SQL Server .dacpac used: yes

@vytautasziurlis Reverse engineering of functions from a .dacpac has not been implemented (yet) - but I will keep this open to get it done, and accept PRs.

Got it, thank you. I'll see how hard this would be to implement since this would be very useful for my use case.

Otherwise it is something I will prioritise before end of September

But please reach out if you get lost in the code.

I am also looking forward to this new feature. Thank you very much @ErikEJ

I implemented a fix for this in the latest daily build, would be grateful if you could try it out.

If you like my free tools, I would be very grateful for a rating or review on Visual Studio Marketplace or even a one-time or monthly sponsorship

I implemented a fix for this in the latest daily build, would be grateful if you could try it out.

Did very basic test and everything looks good to me, thank you!

@vytautasziurlis @Califorro Thanks for the heads up guys, I was great to get this added to .dacpac reverse engineering

Thank you @ErikEJ