How to return multiple SELECT sets from a stored procedure using FromSqlRaw Entity Framework Core 3.1

I am currently having an issue with my returning values from the DB, I am using a SQL Server stored procedure and ASP.NET Core 3.1 to retrieve several SELECT sets.

Here's my stored procedure:

ALTER PROCEDURE [dbo].[MyProc]
    @BusinessModelID int
AS
BEGIN
    SELECT Id, Title 
    FROM [dbo].[Channels] 
    WHERE BusinessModelId = @BusinessModelID;

    SELECT Id, Title 
    FROM [dbo].[Problems] 
    WHERE BusinessModelId = @BusinessModelID;

    SELECT Id, Title 
    FROM [dbo].[CostStructures] 
    WHERE BusinessModelId = @BusinessModelID;

    SELECT Id, Title 
    FROM [dbo].[CustomerSegments] 
    WHERE BusinessModelId = @BusinessModelID;

    SELECT Id, Title 
    FROM [dbo].[KeyMetrics] 
    WHERE BusinessModelId = @BusinessModelID;

    SELECT Id, Title 
    FROM [dbo].[RevenueStreams] 
    WHERE BusinessModelId = @BusinessModelID;

    SELECT Id, Title 
    FROM [dbo].[Solutions] 
    WHERE BusinessModelId = @BusinessModelID;

    SELECT Id, Title 
    FROM [dbo].[Unfairs] 
    WHERE BusinessModelId = @BusinessModelID;

    SELECT Id, Title 
    FROM [dbo].[Values] 
    WHERE BusinessModelId = @BusinessModelID;
END

And here's my C# code:

var modelList = _dataContext.Set<BusinessToGet>()
                        .FromSqlRaw($"EXECUTE MyProc @BusinessModelID={businessModelId}")
                        .ToList();

The problem is that it should return several multiple sets but it is only returning one the Channels. What am I doing wrong?

Thanks in advance.



from Recent Questions - Stack Overflow https://ift.tt/3h9JhI3
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation