0

I am wondering if anyone knows how exactly to go about calling a Package's function within C# code(within a repository class), specifically using LINQ? I have created a package with the help of EDB Postgres documentation. All it does is query a particular database table for the latest value in a particular column. I created and saved the Package into the schema that the table is a part of, but not to the table itself (if that makes sense). What exactly is the process to access a Package's function using LINQ or perhaps another means? EDB Postgres documentation has no examples like this, and similar answers online are for very different circumstances and I was unable to modify them to fit my needs.

Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263
JPho
  • 19
  • 4
  • There are a few ways 1) Use Entity 2) Use SQL Client class and fill DataTable. You can then query DataTable. 3) Raw SQL which can call a stored procedure. – jdweng Mar 27 '23 at 17:03
  • How exactly are you defining a package in Postgres. Other database managers, especially Oracle, have a Package object that houses other database objects (procedures, functions, etc). **Postgres however does not support such packages.** – Belayer Mar 27 '23 at 17:35
  • @Belayer I did it through pgadmin using information from this link: https://www.enterprisedb.com/docs/epas/14/epas_compat_sql/27_create_package_body It says it worked (I see my function within the Packages tab of the schema) but I have no idea how to call it. – JPho Mar 28 '23 at 11:04
  • Ok, then this is not a question about PostgreSQL. I have changed the tags accordingly. – Laurenz Albe Mar 28 '23 at 12:43

1 Answers1

0

Ok, seems like the package and its function can alternatively be called by using the DbFunctionCall() method, which takes in a schemaName, functionName, and optional functionName parameters (in case anyone runs into a similar issue).

JPho
  • 19
  • 4