Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

DbEntityEntry.Cast<TEntity> Method

Entity Framework 5.0

Returns a new instance of the generic DbEntityEntry<TEntity> class for the given generic type for the tracked entity represented by this object. The type of the tracked entity must be compatible with the generic type or an exception will be thrown.

Namespace:  System.Data.Entity.Infrastructure
Assembly:  EntityFramework (in EntityFramework.dll)

public DbEntityEntry<TEntity> Cast<TEntity>()
where TEntity : class

Type Parameters


The type of the entity.

Return Value

Type: System.Data.Entity.Infrastructure.DbEntityEntry<TEntity>
A generic version.
© 2015 Microsoft