Dixin / EntityFramework.Functions

EntityFramework.Functions library implements Entity Framework code first support for stored procedures (with single result type, multiple result types, output parameter), table-valued functions (returning entity type, complex type), scalar-valued functions (composable, non-composable), aggregate functions, built-in functions, niladic functions, and model defined functions.
https://weblogs.asp.net/Dixin/EntityFramework.Functions
MIT License
79 stars 27 forks source link

No way to specify a store name different from an Edm model name. #23

Closed peteawood closed 6 years ago

peteawood commented 7 years ago

Function names containing a "." are not supported in Edm model but are supported as a store name. Attempting to use such a function name in the FunctionAttribute leads to the following error

System.Data.Entity.ModelConfiguration.ModelValidationException : One or more validation errors were detected during model generation:

CodeFirstDatabaseSchema.FUNCTION_NAME.WITH_DOT: Name: The specified name is not allowed: 'FUNCTION_NAME.WITH_DOT'.

   at System.Data.Entity.Core.Metadata.Edm.EdmModel.Validate()
   at System.Data.Entity.DbModelBuilder.Build(DbProviderManifest providerManifest, DbProviderInfo providerInfo)
   at System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection)

EdmFunctionPayload has a StoreFunctionName property which is not subject the same validation as the EdmModel.

Please could either the StoreFunctionName property be exposed via FunctionAttribute or, alternatively, could illegal characters (for EDM model validation) in the FunctionAttribute.FunctionName be converted to legal characters just for the Edm model name and the StoreFunctionName be set internally using the unconverted FunctionName property.

relair commented 6 years ago

I can confirm that causes more problems than just validation. I had oracle TO_CHAR function that has overrides for different parameter types. In the end I ended up not using this library for registering my functions as I couldn't register 2 functions with the same Edm name (it looked like current behavior is overriding previously registered function under same name, making only one working at the same time).

ChristosMylonas commented 6 years ago

Check out PR #29 that directly supports Oracle package procedure/function calls.