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

MetadataException.... #19

Closed MHacker9404 closed 7 years ago

MHacker9404 commented 7 years ago

Getting this exception: System.Data.Entity.Core.MetadataException: Schema specified is not valid. Errors: (0,0) : error 0005: The 'Aggregate' attribute is not allowed. (0,0) : error 0005: The 'BuiltIn' attribute is not allowed. (0,0) : error 0005: The 'NiladicFunction' attribute is not allowed. (0,0) : error 0005: The 'IsComposable' attribute is not allowed. (0,0) : error 0005: The 'ParameterTypeSemantics' attribute is not allowed. (0,0) : error 0005: The 'Schema' attribute is not allowed. (0,0) : error 0005: The 'Mode' attribute is not allowed.

Here is the ModelDefinedFunction that I created and attached to the context: public static class ModelDefinedFunctions { [ModelDefinedFunction(nameof(ParseDecimal), "Envoy.Infrastructure.Data.SqlServer.dbEnvoy", @"cast(svalue as Decimal(20,8))")] public static decimal ParseDecimal(this string svalue) => decimal.Parse(svalue); }

Dixin commented 7 years ago

I have added an example for cast. See 8c0ea5a5a80b32a00471515790728ce3e32c30a9.