EntityState problems in ADO.NET Data Service

If you're getting an error in your ADO.NET Data Service about 'EntityState' not being a valid property, this is the likely cause.

The entity types generated by the ADO.NET Entity Framework include a number of properties that help you manage the entity itself, like providing the EntityKey or as in this case the EntityState. The problem is that EntityState is an enumeration type, which data services don't currently support.

Typically this isn't a problem, because when you are using the ADO.NET Entity Framework, the service will use the properties and types defined in the conceptual model, which of course doesn't mention anything about entity states.

However, if you are using a 'T' that's not the ObjectContext-derived type in your DataService<T>, the service won't know you're using an ADO.NET Entity Framework types, and will try to discover types and properties by following references, which eventually leads to the EntityState property problem. Using the ObjectContext type as the 'T' should then solve the problem.

Comments (0)

Skip to main content