EDM designer doesn’t allow you to write stored procedures and bring them into the database. That means it doesn’t matter whether you opt for the code-first, model-first or database-first approach. You always have to create your stored procedures in the database and later import them into the EDM.
But You Can Do That...
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
DbCommand cmd = Database.Connection.CreateCommand();
cmd.CommandText = "create stored procedure ....";
cmd.ExecuteNonQuery();
}
And For Mapping You Can Use
modelBuilder
.Entity<EntityName>()
.MapToStoredProcedures(s =>
s.Update(u => u.HasName("UpdateStoreProcedureName"))
.Delete(d => d.HasName("deleteStoreProcedureName"))
.Insert(i => i.HasName("insertStoreProcedureName")));
You Can Also Read This
Link