I used Entity Developer (drag'n drop function from db explorer) to create simple mathod based on set returning function.
Code: Select all
CREATE OR REPLACE FUNCTION sp_log_select(p_id integer) RETURNS SETOF log AS
$BODY$
DECLARE row log%rowtype ;
BEGIN
FOR row IN
SELECT * FROM "log"
WHERE ((id=p_id) or (p_id is null))
LOOP RETURN NEXT row;
END LOOP;
END
$BODY$
LANGUAGE 'plpgsql' VOLATILE
Code: Select all
InvoiceDataContext.InvoiceDataContext db = new InvoiceDataContext.InvoiceDataContext(_innerConnection);
db.Log = Console.Out;
System.Linq.IQueryable result = db.SpLogSelect(null);
//set -> Binding source
bsSearch.DataSource = result;
"Entity types only can be used with System.Linq.IQueryable interafce."
What is wrong ?
How it should be invoked to get a result ?
How should I properly use postgres functions to return result set ?
Appreciate any hint ...
Wojtek