This documentation is archived and is not being maintained.

EntityCommand Class

Represents a command to be executed against an Entity Data Model (EDM).

Namespace:  System.Data.EntityClient
Assembly:  System.Data.Entity (in System.Data.Entity.dll)

public ref class EntityCommand sealed : public DbCommand


The EntityCommand is not associated with an EntityConnection property that was changed while a transaction was in progress.


The associated EntityConnection does not have store metadata.


The associated EntityConnection is in the Broken state.

The DbDataReader associated with this EntityCommand is open.

Client-side command compilation consists of the following steps:

  1. Building a command tree from the specified Entity SQL command text if it has not already been built.

  2. Getting the provider factory from the EntityConnection object and using it to create a DbCommandDefinition object. However, if EntityCommand is already associated with a DbCommandDefinition, this step is skipped.

  3. Setting the command tree, parameters, and other settings on the [T:System.Data.Common DbCommandDefinition] object.

  4. Adding the compiled query plan to the cache, if query plan caching is enabled.

For more information about using EntityCommand, see ADO.NET Entity Framework.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5 SP1