Определение составного типа PostgreSQL:
Код: Выделить всё
CREATE TYPE public.udt_associateprofile AS
(
employeeid character varying(100),
type character varying(100),
startdate date,
enddate date,
notes character varying(1000)
);
Код: Выделить всё
CREATE OR REPLACE FUNCTION my_stored_procedure(IN par_username Varchar, IN par_associatedata udt_associateprofile[])
RETURNS VOID AS $$
BEGIN
-- Your logic here
END;
$$ LANGUAGE plpgsql;
Код: Выделить всё
using Npgsql;
using System;
using System.Collections.Generic;
public void Test_Method(DataTable datatable)
{
NpgsqlParameter[] parameters =
{
new NpgsqlParameter("@UserName", NpgsqlDbType.Varchar) { Value = userContext.UserName ?? (object)DBNull.Value },
// How to pass the above datatable as the second parameter.
FormattableString str = FormattableStringFactory.Create(
$"CALL public.\"{spInfo.Name}\"(@UserName, @utAssociateProfileImport)", parameters);
await iapContext.Database.ExecuteSqlInterpolatedAsync(str);
}
Подробнее здесь: https://stackoverflow.com/questions/793 ... cedure-usi