Search code examples
c#linqpaddbfunctions

LinqPad 5 : The name 'DbFunctions' does not exist in the current context


I am trying to use the following in LinqPad (C# Statement):

DbFunctions.TruncateTime(mvOutDt).ToString()

It doesn't seems to recognize DbFunctions. I have added the System.Data.Entity reference. I even tried to fully qualify it using System.Data.Entity.DbFunctions, but no go.

Any help is appreciated.


Solution

  • You are using the incorrect version.

    The DbFunctions class was introduced in Entity Framework 6, which is available via NuGet Package.

    If you are using EF 5 or prior, you will not find a DbFunctions class in the System.Data.Entity namespace, per the documentation.