在Dapper ASP.Net核心样板中删除无法正常工作

时间:2019-01-25 06:58:41

标签: aspnetboilerplate

我正在从样板中的dapper中执行以下存储过程。我点击了链接here,但出现错误

CREATE PROCEDURE [dbo].[DeleteEmployeeById]
	@ID int
AS
BEGIN
 
   DELETE FROM 
[dbo].[Airport] where EmployeeID=@ID
END	

  

过程或函数'DeleteEmployeeById'需要未提供的参数'@ID'

我使用的代码如下:

Dictionary<string, int> dictionary = new Dictionary<string, int>();
            dictionary.Add("@ID", 10);
            try
            {
                
                var people = _repository.Query("DeleteEmployeeById", new DynamicParameters(dictionary));

            }
            catch (System.Data.SqlClient.SqlException exception)
            {
              
            }

1 个答案:

答案 0 :(得分:0)

尝试...

var people = _repository.Query("DeleteEmployeeById", new { id = 10});