I have created the function in PostgreSQL database
example function:
SQL
CREATE FUNCTION find_val(val text)
RETURNS json AS
$$
SELECT row_to_json(sample) FROM sample where $1 = ANY(col4);
$$ LANGUAGE sql;I'm, getting JSON result.
How to execute the function on npgsql EF core?
In below execute method, I'm using item model, but my actual function has multiple tables collaboration and returning JSON result, how to execute without a model in EF core.
Example:
_context.item.FromSqlRaw("select * from log.fn_apiItemo('"+ MobileNumber + "')");
Please suggest any way to resolve this method in EF core.
Thanks.

Muhammad Imran AnsariRank #326 · 7.6K reputationPosted Feb 9, 2022, 5:47 AM EST
You can achieve this using Dapper. Dapper provide extensible extension query method that can be called from any object of type IDbConnection. It can execute a query and map the result. For more information and help follow the link:
https://dapper-tutorial.net/query
Tamil RkRank #4,239 · 356 reputationPosted Feb 9, 2022, 6:04 AM EST
Muhammad Imran AnsariRank #326 · 7.6K reputationPosted Feb 9, 2022, 6:19 AM EST
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts