Code First support for Table-Valued Functions
The EF team has marked the previous TVF feature suggestion as Completed saying TVF support will be included with .NET 4.5. It had 226 votes at the time. However, this excludes Code First support. Vote for this suggestion to specifically add Code First support for TVFs.
Reverting status from “under review” to “no status” since we aren’t currently working on this. We will still consider it for future releases.
lfbicalho . commented
Instead of using the method to call the table value function, you could use an attribute to set that the empty method is a table value function and in the EF expression parser translate it into the call of the function. this could work for table value and for scalar value function in where or in select.
Paweł Kadłuczka commented
This is now possible. I created a custom model convention which allows using store functions in CodeFirst in EF6.1. The convention is available on NuGet http://www.nuget.org/packages/EntityFramework.CodeFirstStoreFunctions. Here is the link to the blogpost containing all the details: http://blog.3d-logic.com/2014/04/09/support-for-store-functions-tvfs-and-stored-procs-in-entity-framework-6-1/
Phil Jones commented
We built our own layer over EF code first, and just discovered that TVFs are not supported. Is there any workaround for code-first until this is implemented?
Patrick Montelo commented
I hope this is added soon. I find it frustrating that Microsoft only supports some features in Database First and some in Code First. For example, if you want to use ASP.NET Identity you're stuck with Code First. But if you want to use TVFs from EF your stuck with Database First. The mapping capabilities are more powerful in Code First, yet I can't map a TVF... a very frustrating experience
Would help fix this issue http://stackoverflow.com/questions/18746127/a-composable-full-text-search-with-a-code-first-model