Here’s how to run a Postgres Function or Postgres Stored Procedure using C#
NpgsqlCommand SqlCommand = new NpgsqlCommand(“stored_proc_name”)
{ CommandType = CommandType.StoredProcedure };
SqlCommand.Parameters.AddWithValue(“param_name1”, NpgsqlTypes.NpgsqlDbType.Text, “param 1”);
SqlCommand.Parameters.AddWithValue(“param_name2”, NpgsqlTypes.NpgsqlDbType.Text, “param 2”);
You can then execute the NpgsqlCommand in the normal way.