Allow table valued functions. This will enable many other scenarios such as full text search or advanced sql querying where LINQ does not support certain TSQL constructs. It can be used as a fallback or last resort whilst still allowing results to be further refined in LINQ.
TVFs are extremely powerful when used in this way with LINQ. A view or scalar function is not applicable in all scenarios as you may need to either provide a parameter or return a set of rows rather than a scalar. TVFs support these scenarios.
Resurrecting this until we have true mapping to TVFs in EF Core.
Entity Framework Core supports invoking TVFs in a FromSql() call. But does not provide mapping for TVFs.
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
Remco Blok commented
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.
Juris Rāts commented
Currently I still use Linq to SQL instead of EF mainly because I use TVFs forcontent localization...
Matthieu MEZIL commented
I wrote a post to be able to do it with EF4 but it's really not perfect.
Nick North commented
I use inline TVFs frequently as the "base" for TSQL queries, and they would fit very naturally into LINQ queries in EF in the same way. Their absence in EF pushes me into using far more stored procedures than I would like.