dapper execute stored procedure code example
Example 1: how to use stored procedure in dapper
var sql = "exec [Sales by Year] @Beginning_Date, @Ending_Date"
Example 2: c# dapper execute stored procedure with parameters
public void GetSomething(int somethingId)
{
IRepository<Something, SomethingEnum> repository = UnitOfWork.GetRepository<Something, SomethingEnum>();
var param = new DynamicParameters();
param.Add("@somethingId", dbType: DbType.Int32, value:somethingId, direction: ParameterDirection.Input);
var result = repository.Exec<Something>(SomethingEnum.spMyStoredProcedure, param);
...
}