/// <summary> /// Gets the identity for a given entity instance. /// </summary> /// <returns>The identity.</returns> /// <param name="entity">Entity.</param> /// <typeparam name="TEntity">The entity type.</typeparam> public static IIdentity <TEntity> GetIdentity <TEntity>(this TEntity entity) where TEntity : IEntity { return((IIdentity <TEntity>)Identity.Create(entity.GetType(), entity.GetIdentityType(), entity.IdentityValue)); }