It's achievable, there is a great explanation in MSDN . Check this article, it shows two ways to achieve it:
https://msdn.microsoft.com/en-us/data/jj691402.aspx
For Your requirements use approach 2 (Multiple Result Sets with Configured in EDMX).
Once You do this You can use those results with Linq without a problem.For example
Public void SelectValues()
{
using (Entities1 entity = new Entities1())
{
var Employees = entity.SP_GetResult;
var Customers = Employees.GetNextResult<Customer>();
// do your stuff
}
}
To 'join' those 2 collection You can use a Tuple Collection
Tuple<EmployeeTable, Customer>
Since the above approach works only for .NET 4.5 and higher, you can use the first approach from the article. It also suits you. You can use linq there. Look at my example:
public List<EmployeeTable> GetEmployees()
{
using(var ctx = new myEntities())
{
var cmd = ctx.Database.Connection.CreateCommand();
cmd.CommandText = "[dbo].[SP_GetResult]";
var reader = cmd.ExecuteReader();
//reader.NextResult(); <- uncomment this to get second result(Customer)
var employees = ((IObjectContextAdapter)db)
.ObjectContext
.Translate<EmployeeTable>(reader, "EmployeeTable", MergeOption.AppendOnly);
return employees;
}
Now You can use linq like:
var boss = GetEmployees().FirstOrDefault(x => x.Name == "BossName");
Alternative:
Actually to do such simple queries You don't need to have it in one sp. You don't even need store procedures for this. Having only EF You can get it like this:
using (var ctx = new myEntities())
{
var employyes = from x in ctx.EmployeeTable select new
{
id = x.Id,
name = x.Name
}
}