Stored Procedure as a Class

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
Matejo
Posts: 2
Joined: Thu 11 Jan 2018 17:06

Stored Procedure as a Class

Post by Matejo » Thu 24 Jan 2019 15:13

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

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

Re: Stored Procedure as a Class

Post by Shalex » 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.

Matejo
Posts: 2
Joined: Thu 11 Jan 2018 17:06

Re: Stored Procedure as a Class

Post by Matejo » Tue 29 Jan 2019 16:19

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?

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

Re: Stored Procedure as a Class

Post by Shalex » Fri 01 Feb 2019 16:29

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

Post Reply