I am very new to Entity Framework 6 and I want to implement stored procedures in my project. I have a stored procedure as follows:
ALTER PROCEDURE [dbo].[ins
It work for me at code first. It return a list with matching property of view model(StudentChapterCompletionViewModel)
var studentIdParameter = new SqlParameter
{
ParameterName = "studentId",
Direction = ParameterDirection.Input,
SqlDbType = SqlDbType.BigInt,
Value = studentId
};
var results = Context.Database.SqlQuery(
"exec dbo.sp_StudentComplettion @studentId",
studentIdParameter
).ToList();
Updated for Context
Context is the instance of the class that Inherit DbContext like below.
public class ApplicationDbContext : DbContext
{
public DbSet City { get; set; }
}
var Context = new ApplicationDbContext();