///<summary> /// This method is responsible to derive the command parameter list with values obtained from function definition. /// It clears the Parameters collection of command. Also, if there is any parameter type which is not supported by Npgsql, an InvalidOperationException will be thrown. /// Parameters name will be parameter1, parameter2, ... for CommandType.StoredProcedure and named after the placeholder for CommandType.Text /// Additionally, output column types for each executed statement within command will be inferred ///</summary> /// <param name="command">NpgsqlCommand whose function parameters will be obtained.</param> public static ReadOnlyCollection <ReadOnlyCollection <NpgsqlDbColumn> > DeriveParametersAndOutputTypes(NpgsqlCommand command) { command.DeriveParameters(); return(command.Statements .Select(s => new DbColumnSchemaGenerator(command.Connection, s.Description, false).GetColumnSchema()) .ToList() .AsReadOnly()); }
///<summary> /// /// This method is reponsible to derive the command parameter list with values obtained from function definition. /// It clears the Parameters collection of command. Also, if there is any parameter type which is not supported by Npgsql, an InvalidOperationException will be thrown. /// Parameters name will be parameter1, parameter2, ... for CommandType.StoredProcedure and named after the placeholder for CommandType.Text ///</summary> /// <param name="command">NpgsqlCommand whose function parameters will be obtained.</param> public static void DeriveParameters(NpgsqlCommand command) { command.DeriveParameters(); }