var results = obj.StoreProc(154081);
var products = results.GetNextResult<StoreProc_Result2>();
hold the data of both result sets that come from the stored procedure, right?[DataContract]
public class MyResultType
{
[DataMember]
public List<StoreProc_Result1> Results { get; set; }
[DataMember]
public List<StoreProc_Result2> Products { get; set; }
}
And this is the object you need to fill and return from the WCF method.
[ServiceContract]
public interface IMultiResult
{
[OperationContract]
MyResultType DoWork(); //What should be the return type here for sure not void :-)?
}
public class MultiResullt : IMultiResult
{
public MyResultType DoWork()
{
EntityModelobj = new EntityModel();
var results = obj.StoreProc(154081);
var products = results.GetNextResult<StoreProc_Result2>();
var response = new MyResultType();
response.Results = results;
response.Products = products;
return response;
}
}
I have to tell you that these names are horrible, so take your time to name everything properly but in essence, this is the basic idea.
What is the method contract?
WCF doesn't care about your DB, it's the contract that defines what is returned.
My suggestion is that you create your business model POCO object that you want to be returned by the WCF method and fill it with the data that is returned from the Stored Procedure.