问题描述
我不知道如何调用存储过程,所以有人可以帮助我.....
我尝试了什么:
公共类DemoEntityContext:DbContext
{
public DemoEntityContext():base(DbContext ){}
public DbSet< student>学生{得到;组; }
public DbSet< course>课程{get;组; }
public DbSet< enrollment>报名{get;组; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity< student>() .MapToStoredProcedures();
}
公共学生GetDetailsByID(字符串详细信息)
{
//在这个函数中我需要调用SP;
}
}
I don't know how to call a stored procedure so someone can help me out.....
What I have tried:
public class DemoEntityContext : DbContext
{
public DemoEntityContext() : base("DbContext") { }
public DbSet<student> Students { get; set; }
public DbSet<course> Courses { get; set; }
public DbSet<enrollment> Enrollments { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<student>().MapToStoredProcedures();
}
public Student GetDetailsByID(string Details)
{
// in this function i need to call the "SP";
}
}
推荐答案
这篇关于如何在codefirst方法实体框架中调用存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!