views:

34

answers:

1

Hi everybody. I have a question. Please it´s extremely urgent !!

I created a Store Procedure to make tests for study its functionality.

my procedure execute two selects:

Example: Select TOP 20 * From NotaFiscal Select TOP 20 * From ProdutoNotaFiscal

Using the ADO.NET, the Dataset is filled with 2 results and generates 2 DataTables. Using Linq to SQL the type of return is a ISingleResult

I need to get the 2 returns of my procedure, but I'm not able to do that.

Somebody knows how can I get the result of 2 selects from procedure to LINQ ?

Regards

A: 

You would need to create a partial class for your datacontext, and then add a method that wrap the result of your stored procedure and cast it to a IMultipleResults.

public partial class EntitiesDataContext
  {
    [Function(Name = "dbo.SPReturnMultipleResult")]
    [ResultType typeof(NotaFiscal)]
    [ResultType typeof(ProductoNotaFiscal)]
    public IMultipleResults SPReturnMultipleResult()
    {
      IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())));
      return ((IMultipleResults)(result.ReturnValue));
    }
alejandrobog