MSSQL table type parameters

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
Flub
Posts: 9
Joined: Thu 01 Jun 2006 14:38

MSSQL table type parameters

Post by Flub » Wed 17 Nov 2021 09:05

Hi,
I am new to Entity Developer and like it a lot.
However I came to a problem I don't know how to solve and I really need a solution as 90% of my MS SQL procs uses them: Table-type parameters. For example:
CREATE TYPE [dbo].[IDs] AS TABLE([id] bigint NOT NULL);
CREATE PROCEDURE [dbo].[pTestIDs] (
@IDs dbo.IDs READONLY
) AS BEGIN
-- Do whatever with @IDs table content...
END;
I unfortunately could not import directly my MSSQL types in ED, but did it however manually, creating Complex types.

In ED, the pTestIDS @IDs parameter data type is set automatically to "Object", but cannot be changed to structured.
As such, in ASP.Net Core, generated code creates a:
DbParameter sortParameter = cmd.CreateParameter();
sortParameter.DbType = DbType.Object;

But what would be needed is this:
if (IDs != null) {
SqlParameter sortParameter = new SqlParameter();
sortParameter.ParameterName = "ids";
sortParameter.SqlDbType = SqlDbType.Structured;
sortParameter.Value = ids;
sortParameter.Direction = ParameterDirection.Input;
}

Of course I could do it manually in the code, but I loose the possbility to re-generate C# classes...
Do you have an example on how to load the DbType.Object with a List<IDs> in ASP.Net Core or is there a way to generate the code from ED as a SqlDbType.Structured?

Thanks a lot!

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: MSSQL table type parameters

Post by Shalex » Wed 17 Nov 2021 14:13

Entity Developer doesn't support the generation of stored procedure calls in EF Core Model at the moment. We will notify you when the feature is implemented.

Post Reply