Answers for "entity framework and stored procedure parameters"

C#
2

calling stored procedure in c# entity framework

using (var db = new SyXEntities())
{
	var repeatDetails = db.Database.SqlQuery<RepeatBetDetail>("Get_RepeatBetDetails @BetID", new SqlParameter("BetID", betID)).ToList();
	return repeatDetails;
}
Posted by: Guest on August-13-2021
0

entity framework call stored procedure with parameters

using (var entities = new YourEntities())
                {
                    SqlParameter[] parameters =
                      {
                          new SqlParameter{
                                SqlDbType = SqlDbType.NVarChar,
                                Size = -1,
                                Direction = ParameterDirection.Input,
                                ParameterName = "InCompanyCode",
                                Value = SD.Company
                            },
                            new SqlParameter{
                                SqlDbType = SqlDbType.NVarChar,
                                Size = -1,
                                Direction = ParameterDirection.Input,
                                ParameterName = "InDebugModeOn",
                                Value = "0"
                            }
                        };

                   return entities.Database.SqlQuery<Your_Model>
                        (@"EXECUTE YourSP @InCompanyCode,@InBranchCode", parameters).ToList();                }
Posted by: Guest on January-05-2022

Code answers related to "entity framework and stored procedure parameters"

C# Answers by Framework

Browse Popular Code Answers by Language