I have generated Entity CodeBlock for my database objects and choose some of my user defined scalar functions. But when i tried to double click on functions in Model.Store to import function i get this error.
Function imports cannot be created for composable functions.
How can i import my functions?
I don’t know what I was seeing with the ExecuteFunction, but it wasn’t working. I finally got an end-to-end solution together with help from this post and the article shown in the other responses.
Step one is to get the function into your EDMX file:
Step two is to setup a class in the same namespace as the EDMX file (easily done by creating class in the same directory as the EDMX file:
Step three is to write an object query pointing to the function:
The key for me was the CreateQuery call on the object context and syntax of the “query string”. Notice the fully qualified reference to the function defined in the EDMX, that was my missing link 🙂