3

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.

DJ Burb
  • 2,346
  • 2
  • 29
  • 38
  • I cannot reproduce this in LinqPad 5. Works just fine. Are you certain you added the correct nuget package version? – David L Jul 19 '16 at 18:43
  • Yeah, my co-worker tried it on his and it works fine. I don't think there is a nuget package for it. System.Data.Entity is built in – DJ Burb Jul 19 '16 at 18:44

1 Answers1

7

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.

David L
  • 32,885
  • 8
  • 62
  • 93
  • What it is looking like.... I am using the basic version which will not allow me to get the Entity Framework 6 package.... my co-worker has the premium version. So you may be right. – DJ Burb Jul 19 '16 at 18:58
  • 1
    That would probably do it. You're pulling from the .NET Framework installed version which would be EF 5 or earlier. – David L Jul 19 '16 at 19:00