TTCG
TTCG

Reputation: 9113

Cannot use EF canonical functions

I am using EF 4.0 with SQL Server 2008 and C#.

I have declared EF in my web.config as shown below:

<assemblies>
    <add assembly="System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
    <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
    <add assembly="System.Data.Entity.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
  </assemblies>
  <buildProviders>
    <add extension=".edmx" type="System.Data.Entity.Design.AspNet.EntityDesignerBuildProvider" />
  </buildProviders>

But when I try to use EF Canonical's functions such as TruncateTime, etc. I could not find "EntityFunctions" in the Intellisense list and it shows error. Please see the screenshot below. Which library do I need to import? Thanks.

enter image description here

My Current declaration for libraries are:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;

Upvotes: 1

Views: 332

Answers (1)

GrandMasterFlush
GrandMasterFlush

Reputation: 6409

Try:

where i.Locked == true

where i.DateOfInterview == EntityFunctions.TruncateTime(DateTime.Now.Date)

You'll need using System.Data.Objects.

Upvotes: 1

Related Questions