19

I'm trying to added stored procedure through Model browser, the SP had a table valued parameter. SP is added with function imports, But it's missing the table valued parameter. SP had 5 parameters including tvp, but i can see only 4 parameter and tvp parameter is missing.

I did googling to find the reason and solution. Everyone is suggesting to use entitie's ExecuteStoreProcedure method. e.g. Entity Framework Stored Procedure Table Value Parameter

But i want to use the function import which is created while we add SP using Model browser, all other SPs works well as they don't have tvp. Note: using EF 6.1.1 and .net 4.5, and VS2013

Quetion: does C# and EF supports importing SP wtih TVP ?

Community
  • 1
  • 1
Kireet
  • 191
  • 4

1 Answers1

1

A github post was submitted regarding the issue, concerning EF core but applicable to EF 6 as well:

  • Stored procedures are only supported in raw/inline SQL in Entity Framework Core.
  • Table Valued Parameters are only supported in raw/inline SQL in Entity Framework Core because we just pass any SqlParameter through
    to the underlying ADO.NET provider.
  • We initially used "Entity Framework 7" as the name for EF Core, but there is no released product called "Entity Framework 7" so I am not
    100% which product you are referring to.

Microsoft initial thought was to prepare EF 6 towards the new EF core standards, so they decided they will support the table valued parameters only on raw/inline sql.

You pass the SqlParameter to the underlying ado.net provider either way so there really is no reason to pass the param through Functions Import.

So yes, the way for you to go is to use ExecuteStoreProcedure as Microsoft is aptly prompting to do so, or just add the code yourself by extending the partial class with implementation of your own.

Barr J
  • 10,636
  • 1
  • 28
  • 46