stored procedure with 3 queries in DalLinq

stored procedure with 3 queries in DalLinq

Old forum URL: forums.lhotka.net/forums/t/9259.aspx


lazaroms posted on Thursday, July 22, 2010

Hi all:

I have an SP, it has 3 queries inside, two of them returns a list and the other one return single data.

How must I implement a partial class for the result to integrate it to the DalLinq datacontext????

This is my SP

 

Normal 0 21 false false false ES-MX X-NONE X-NONE MicrosoftInternetExplorer4

ALTER PROCEDURE [dbo].[spGetDataandLists]

      (

      @Id UniqueIdentifier

      )

AS

SELECT Id, Name, Desc

FROM   Perm

WHERE  (Id = @Id)

--List #1 (children)

SELECT pegr.Id, grus.Id, grus.Name, grus.Acti

FROM   grus INNER JOIN

       pegr ON grus.Id = pegr.grus_Id INNER JOIN

       Perm ON pegr.perm_Id = perm.Id

WHERE  (pegr.perm_Id = @Id)

--List #2 (potential children)

SELECT Id, Name, Acti

FROM   grus

WHERE  Id NOT IN (SELECT grus_Id FROM pegr WHERE (perm_Id = @Id))

lazaroms replied on Friday, July 23, 2010

Hi, it' me again.

I found the answer to my question in this article,  http://msdn.microsoft.com/en-us/library/bb399344.aspx

It´s worth to clear that MultipleResultTypesSequentiallyResult1 and MultipleResultTypesSequentiallyResult2 must be declared by th developer en the DataContext  Partial Class of the O/R designer, NOT in the auto-generated code.

Those types mus be declared following the classes in the auto.generated code as a pattern.

Thanks.

 

L.M.Santin

Copyright (c) Marimer LLC