Mapping Builtin Functions (FORMAT)

Aug 28, 2015 at 11:34 PM
There doesn't appear to be a way to map built-in functions using this API. I'm trying to map the FORMAT function...and the API tries to pre-pend the default schema when invoking it which is incorrect and results in an exception.

To support my scenario, the EdmPayloadFunction.IsBuiltIn property needs to be set to TRUE (by either the StoreFunctionBuilder or the FunctionsConvention class).

Is there any chance that this will be supported in the future? As is, unfortunately I cannot use the API, which is a shame as it makes registration so simple!

Thanks!
        [DbFunction("CodeFirstDatabaseSchema", "FORMAT")]
        public static string Format(decimal value, string format)
        {
            throw new NotSupportedException("This method is not intended to be called directly.");
        }
Coordinator
Aug 31, 2015 at 5:02 AM
This seems like a reasonable feature requests. I created a work item to track this: https://codefirstfunctions.codeplex.com/workitem/14. I have not touched this code in quite a long time now but this feature appears not to be hard and is pretty appealing.

Thanks,
Pawel
Sep 26, 2016 at 7:45 PM
I've implemented the feature of using built in functions: https://codefirstfunctions.codeplex.com/SourceControl/network/forks/BalintPogatsa/BuiltInFunctions

I've tested it with Oracle, but it should work with other DBs too:
    [DbFunction("CodeFirstDatabaseSchema", "TO_DATE")]
    [DbFunctionDetails(IsBuiltIn=BuiltInOptions.BuiltIn)]
    public static DateTime ToDate(string dateTimeToConvert, string convertFormat)
    {
        // no need to provide an implementation
        throw new NotSupportedException();
    }
Regards,

Bálint
Coordinator
Sep 28, 2016 at 4:57 PM
Bálint, Can you open a pull request?
Oct 2, 2016 at 9:47 AM
I've opened
Coordinator
Oct 5, 2016 at 9:01 PM
Edited Oct 5, 2016 at 9:02 PM
Thank you. I saw you opened the PR but have not had a chance to really look at it.
Coordinator
Oct 24, 2016 at 3:23 AM
Thanks again for the PR. It has been merged to master.