I am trying to call a Postgresql stored procedure written in plpgsql using C# and Dapper, but I have found that Dapper alphabetizes the parameters before inserting them into the stored procedure. Is there a way I can avoid this behavior and have the items inserted in the correct order?
For example, the following call would not run correctly because it would alphabetize the parameter names. I have to manually alphabetize them for the call to go through.
int map_id = conn.Query<int>(
"insert_color",
new
{
zebra_name = new DbString { Value = slide_name },
door_name = new DbString { Value = fov_name },
foo_number = cycle_number,
variable_path = new DbString { Value = image_path },
random_path = new DbString { Value = meta_path },
x = x,
y = y,
z = z,
exposure = exposure,
type_name = new DbString { Value = image_type },
copy = copy
},
commandType: CommandType.StoredProcedure).First();
Here is the stored procedure declaration:
CREATE OR REPLACE FUNCTION insert_color(
zebra_name text, door_name text, foo_number integer,
variable_path text, random_path text,
x real, y real, z real, exposure real,
type_nametext, copy integer) RETURNS integer AS $$
...
$$ LANGUAGE plpgsql;