Execute stored procedure using entity framework

前端 未结 4 778
鱼传尺愫
鱼传尺愫 2020-12-29 15:43

is it possible to execute a stored procedure using EF, that select records from database from two or more tables using inner join and left outer join.

my point of vi

4条回答
  •  情深已故
    2020-12-29 16:47

    In you are using Entity Framework with MySQL:

    In this example, my stored procedure is expecting one parameter, named myParam of type BIGINT

    var myParam = new SqlParameter("@myParam", (MySqlDbType.Int64)).Value = 100;
    
    var res = _context.Database.SqlQuery($"call MyProcedureName({pyParam})");
    

    Note that I am using C# String Interpolation to build my query string.

提交回复
热议问题