Why am I getting this error: No mapping specified for the following EntitySet/AssociationSet – Entity1?

This is because of the way EF4 works with model-first. When you first create a model-first model, it’s in a state that the SSDL does not exist. You can drag entities, associate them and so forth and yet, if you take a look at the SSDL on the EDMX file, you will see that none … Read more

Does Entity Framework Code First support stored procedures?

EDIT: My original answer for EF4.1 (below) is now out of date. Please see the answer below from Diego Vega (who works on the EF team at Microsoft)! @gsharp and Shawn Mclean: Where are you getting this information? Don’t you still have access to the underlying ObjectContext? IEnumerable<Customer> customers = ((IObjectContextAdapter)this) .ObjectContext.ExecuteStoreQuery<Customer>(“select * from customers”); … Read more

How can I query for null values in entity framework?

Workaround for Linq-to-SQL: var result = from entry in table where entry.something.Equals(value) select entry; Workaround for Linq-to-Entities (ouch!): var result = from entry in table where (value == null ? entry.something == null : entry.something == value) select entry; This is a nasty bug which has bitten me several times. If this bug has affected … Read more

The specified type member ‘Date’ is not supported in LINQ to Entities Exception

You can use the TruncateTime method of the EntityFunctions to achieve a correct translations of the Date property into SQL: using System.Data.Objects; // you need this namespace for EntityFunctions // … DateTime ruleData = Convert.ToDateTime(rule.data).Date; return jobdescriptions .Where(j => EntityFunctions.TruncateTime(j.JobDeadline) == ruleData); Update: EntityFunctionsis deprecated in EF6, Use DbFunctions.TruncateTime

Like Operator in Entity Framework?

I don’t know anything about EF really, but in LINQ to SQL you usually express a LIKE clause using String.Contains: where entity.Name.Contains(“xyz”) translates to WHERE Name LIKE ‘%xyz%’ (Use StartsWith and EndsWith for other behaviour.) I’m not entirely sure whether that’s helpful, because I don’t understand what you mean when you say you’re trying to … Read more