Closed jdwill916 closed 3 years ago
You can call Oracle package procedures/functions using function attribute. For example to call GETVERSIONBYPRODUCTNAMEFUNC function on EF_TESTPACKAGE of MYSCHEMA schema use:
[Function(FunctionType.StoredProcedure, "GetVersionByProductNamePackageFunction",
Schema = "MYSCHEMA", StoreFunctionName = "EF_TESTPACKAGE.GETVERSIONBYPRODUCTNAMEFUNC")]
public ObjectResult<Entity.Version> GetVersionByProductNamePackageFunction(string productName)
{
ObjectParameter productNameParameter = !String.IsNullOrEmpty(productName)
? new ObjectParameter("piProductName", productName)
: new ObjectParameter("piProductName", typeof(string));
var a = this.ObjectContext();
return this.ObjectContext().ExecuteFunction<Entity.Version>(
"GetVersionByProductNamePackageFunction", productNameParameter);
}
more on https://github.com/Dixin/EntityFramework.Functions/pull/29
Thank you for adding this! I have downloaded the latest version of the project from NuGet (1.4.1) and the StoreFunctionName
parameter is not found. Will this be in the next NuGet version, and is there an estimated time-frame when it will be deployed?
I think that it has already been deployed. :smile:
Sadly, it has not, as far as I can tell, been added to the most recent NuGet package (1.4.1). Hopefully it will be added soon.
Sadly it's not in the compiled version of v1.4.1. Could you please release a newer version @Dixin?
This does not work for anything that is in a package, due to packages requiring a separate period of separation. When a package is used, the SQL generated needs to be in the pattern of
"[schema]"."[package]"."[function]"()
, but this software only supports the pattern of"[schema]"."[function]"()
.I have attempted to use the add the package to the schema parameter as
Schema = "mySchema.myPackage"
but this renders the SQL like this:"mySchema.myPackage"."myFunction"()
leaving the "." inside of the quotes, and causing the database to look for a schema calledmySchema.myPackage
which does not exist.Would it be possible to add in an optional "Package" parameter to the attribute call that, if populated, would add in the supplied package to the query?