src/Shared/EntityFramework/Infrastructure/DbEntityEntry.cs
/// <summary>
/// Returns a new instance of the generic <see cref="DbEntityEntry{T}" /> class for the given
/// generic type for the tracked entity represented by this object.
/// Note that the type of the tracked entity must be compatible with the generic type or
/// an exception will be thrown.
/// </summary>
/// <typeparam name="TEntity"> The type of the entity. </typeparam>
/// <returns> A generic version. </returns>
Returns a new instance of the generic  class for the given
generic type for the tracked entity represented by this object.
Note that the type of the tracked entity must be compatible with the generic type or
an exception will be thrown.
Returns a new instance of the generic class for the given generic type for the tracked entity represented by this object . Note that the type of the tracked entity must be compatible with the generic type or an exception will be thrown .
public DbEntityEntry<TEntity> Cast<TEntity>() where TEntity : class
        {
            if (!typeof(TEntity).IsAssignableFrom(_internalEntityEntry.EntityType))
            {
                throw Error.DbEntity_BadTypeForCast(
                    typeof(DbEntityEntry).Name, typeof(TEntity).Name, _internalEntityEntry.EntityType.Name);
            }
            return new DbEntityEntry<TEntity>(_internalEntityEntry);
        }
public DbEntityEntry < TEntity > Cast < TEntity > ( ) where TEntity : class { if ( ! typeof ( TEntity ) . IsAssignableFrom ( _internalEntityEntry . EntityType ) ) { throw Error . DbEntity_BadTypeForCast ( typeof ( DbEntityEntry ) . Name , typeof ( TEntity ) . Name , _internalEntityEntry . EntityType . Name ) ; } return new DbEntityEntry < TEntity > ( _internalEntityEntry ) ; }
Returns a new instance of the generic  class for the given
generic type for the tracked entity represented by this object.
Returns a new instance of the generic class for the given generic type for the tracked entity represented by this object .
A generic version.
A generic version .
typeparam
The type of the entity.
The type of the entity .