当我尝试使用dapper调用postgre函数时,出现了错误。我做错了什么?如果您能帮忙解决,我将不胜感激。
错误信息:
availability_list(facilityId => integer, startDate => timestamp without time zone, endDate => timestamp without time zone) does not exist"
使用Dapper调用Postgre函数:
var func = "public.availability_list";
var result = db.Query<ReportResponse>(
sql: func,
param: new { facilityId = request.FacilityId, startDate =
DateTime.Now, endDate = DateTime.Now },
commandType: CommandType.StoredProcedure,
commandTimeout: 900) as List<ReportResponse>;
我的Postgre函数:
CREATE FUNCTION Availability_List(facilityId int, startDate date, endDate date)
RETURNS report_type[]
AS
$$
DECLARE
result_record report_type[];
BEGIN
result_record := array(
SELECT...
);
RETURN result_record;
END $$ LANGUAGE plpgsql;