I have the following Dapper command to insert values into a table using a stored procedure.
sqlConnection.Execute(
"sp_LocationTypes_Insert"
, parameters
, commandType: CommandType.StoredProcedure
);
where the parameters are created using
var parameters = new DynamicParameters();
parameters.Add("@updated", dbType: DbType.DateTime, direction: ParameterDirection.Output);
parameters.Add("@description", locationType.description);
In addition, the SP needs to be executed multiple times, once for each LocationType object in a list. I could put the list in a loop and call the Execute command for each instance. However, is there a way to have Dapper iterate the list of objects and execute the SP? I do not want to put the T-SQL as a string.
I have spent a while in the Dapper Source and have seen nothing in regards to dapper iterating internally like you are asking. For this question i referenced Dapper's unit tests and i can find no example of dapper attempting to do this. With this being said, i would assume it does not.
Here is the link to their general unit tests, if you browse up a level they have it organized into other sections.
https://github.com/StackExchange/Dapper/blob/master/Dapper.Tests/Tests.cs
I consider this to be my comprehensive guide on 'how to use' dapper.