Click here to Skip to main content
15,882,794 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
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";
}
}
Posted
Updated 17-Mar-17 3:26am

1 solution

There are several solutions available via Google. Such as this one - c# - How to call Stored Procedure in Entity Framework 6 (Code-First)? - Stack Overflow[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900