I want to pass a list of Ids to a stored procedure using Simple.Data.
My stored procedure is...
CREATE TYPE IntValue AS TABLE (Value INT)
GO
CREATE PROCEDURE testTableSproc
@items IntValue READONLY
AS
SELECT * FROM @items
So far I've tried...
public class IntValue
{
public int Value { get; set; }
}
var db = Database.OpenNamedConnection("MyConnection")
var array = new int[] {1, 2, 3};
List<IntValue> results = db.testTableSproc(items: array);
also
List<IntValue> results = db.testTableSproc(
items: array.Select(x => new IntValue{ Value = x}).ToArray());
Any solutions or confirmation that this is not supported?
Figured it out - Simple.Data accepts DataTable as a type.
The syntax for working with DataTables is quite clunky but it can be refactored out of sight.