Page 1 of 1

Stored Procedure as a Class

Posted: Thu 24 Jan 2019 15:13
by Matejo
HI, I'm using SQL server and I'm wondering if Is it possible to import a stored procedure as Class in Entity developer? (in this way I can use SP to query/insert/update/delete)

Thank you

Re: Stored Procedure as a Class

Posted: Tue 29 Jan 2019 15:00
by Shalex
You can map the result set of your stored procedure to a complex type in your model. Refer to https://www.devart.com/linqconnect/docs ... rview.html.

Re: Stored Procedure as a Class

Posted: Tue 29 Jan 2019 16:19
by Matejo
Matejo wrote: Thu 24 Jan 2019 15:13 (in this way I can use SP to query/insert/update/delete)
Shalex wrote: Tue 29 Jan 2019 15:00 You can map the result set of your stored procedure to a complex type in your model. Refer to https://www.devart.com/linqconnect/docs ... rview.html.
Ok but with a complex type I cannot see the option "Stored Procedure Mapping" that I see under "Classes" and that's my need: am I missing something?

Re: Stored Procedure as a Class

Posted: Fri 01 Feb 2019 16:29
by Shalex
That is designed behavior. Complex type does not duplicate the functionality of a class. Complex type just represents several properties of a class or the result set of a stored procedure.

Workarounds:

1) create a view in the database that represents a result set of your stored procedure, add it to the model and assign to Return Type of the method via Method Editor

2) create a class in your model (without a view in the database) and use it as Return Type

3) open *.lqml with an XML Editor and modify an existing complex type to transform it into a class