I have a stored procedure that I would to call from Entity Framework. In the result there is three table being returned. The stored procedure takes in two parameters, UserId
and BlogId
. Do I need the database open and the command.ExecuteReader
? Can Entity Framework handle multiple data reads?
public List<Models.BlogInfo> GetBlogListing(int UserId, int BlogId)
{
using (var db = new Entities())
{
using (DbContextTransaction dbTran = db.Database.BeginTransaction())
{
ResultStatus resultStatus = new ResultStatus();
try
{
var cmd = db.Database.Connection.CreateCommand();
cmd.CommandText = "[coi].[usp_Public_Select_GetPanelBlog]";
SqlParameter paramMeetingId = new SqlParameter("@UserId", UserId);
SqlParameter paramGroupId = new SqlParameter("@BlogId", BlogId);
Database.OpenConnection();
using (var result = command.ExecuteReader())
{
}
}
catch (Exception ex)
{
dbTran.Rollback();
}
}
}
}