diff --git a/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php
index c7f4275..0bad9af 100644
--- a/core/lib/Drupal/Core/Entity/ContentEntityBase.php
+++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php
@@ -353,7 +353,10 @@ public function __wakeup() {
    * {@inheritdoc}
    */
   public function id() {
-    return $this->id->value;
+    if (!isset($this->idKeyName)) {
+      $this->idKeyName = $this->getEntityType()->getKey('id');
+    }
+    return $this->get($this->idKeyName)->value;
   }
 
   /**
diff --git a/core/lib/Drupal/Core/Entity/Entity.php b/core/lib/Drupal/Core/Entity/Entity.php
index 714aeeb..c656316 100644
--- a/core/lib/Drupal/Core/Entity/Entity.php
+++ b/core/lib/Drupal/Core/Entity/Entity.php
@@ -16,6 +16,13 @@
 abstract class Entity implements EntityInterface {
 
   /**
+   * Local cache holding the value of the ID key name from annotation.
+   *
+   * @var string
+   */
+  protected $idKeyName;
+
+  /**
    * The language code of the entity's default language.
    *
    * @var string
@@ -64,7 +71,10 @@ public function __construct(array $values, $entity_type) {
    * {@inheritdoc}
    */
   public function id() {
-    return isset($this->id) ? $this->id : NULL;
+    if (!isset($this->idKeyName)) {
+      $this->idKeyName = $this->getEntityType()->getKey('id');
+    }
+    return isset($this->{$this->idKeyName}) ? $this->{$this->idKeyName} : NULL;
   }
 
   /**
diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Entity/Feed.php b/core/modules/aggregator/lib/Drupal/aggregator/Entity/Feed.php
index 61eae79..a384862 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/Entity/Feed.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/Entity/Feed.php
@@ -46,13 +46,6 @@
 class Feed extends ContentEntityBase implements FeedInterface {
 
   /**
-   * Implements Drupal\Core\Entity\EntityInterface::id().
-   */
-  public function id() {
-    return $this->get('fid')->value;
-  }
-
-  /**
    * Implements Drupal\Core\Entity\EntityInterface::label().
    */
   public function label() {
diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Entity/Item.php b/core/modules/aggregator/lib/Drupal/aggregator/Entity/Item.php
index e48e45d9..f20bf9d 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/Entity/Item.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/Entity/Item.php
@@ -33,13 +33,6 @@
 class Item extends ContentEntityBase implements ItemInterface {
 
   /**
-   * Implements Drupal\Core\Entity\EntityInterface::id().
-   */
-  public function id() {
-    return $this->get('iid')->value;
-  }
-
-  /**
    * Implements Drupal\Core\Entity\EntityInterface::label().
    */
   public function label() {
diff --git a/core/modules/comment/lib/Drupal/comment/Entity/Comment.php b/core/modules/comment/lib/Drupal/comment/Entity/Comment.php
index 906e6e7..b291c5a 100644
--- a/core/modules/comment/lib/Drupal/comment/Entity/Comment.php
+++ b/core/modules/comment/lib/Drupal/comment/Entity/Comment.php
@@ -209,13 +209,6 @@ protected function init() {
   }
 
   /**
-   * Implements Drupal\Core\Entity\EntityInterface::id().
-   */
-  public function id() {
-    return $this->get('cid')->value;
-  }
-
-  /**
    * {@inheritdoc}
    */
   public function preSave(EntityStorageControllerInterface $storage_controller) {
diff --git a/core/modules/contact/lib/Drupal/contact/Entity/Message.php b/core/modules/contact/lib/Drupal/contact/Entity/Message.php
index 573b304..c03d5ea 100644
--- a/core/modules/contact/lib/Drupal/contact/Entity/Message.php
+++ b/core/modules/contact/lib/Drupal/contact/Entity/Message.php
@@ -37,7 +37,7 @@
 class Message extends ContentEntityBase implements MessageInterface {
 
   /**
-   * Overrides Drupal\Core\Entity\Entity::id().
+   * {@inheritdoc}
    */
   public function id() {
     return NULL;
diff --git a/core/modules/editor/lib/Drupal/editor/Entity/Editor.php b/core/modules/editor/lib/Drupal/editor/Entity/Editor.php
index 27346c9..1d6bbd6 100644
--- a/core/modules/editor/lib/Drupal/editor/Entity/Editor.php
+++ b/core/modules/editor/lib/Drupal/editor/Entity/Editor.php
@@ -58,13 +58,6 @@ class Editor extends ConfigEntityBase implements EditorInterface {
   public $image_upload = array();
 
   /**
-   * Overrides Drupal\Core\Entity\Entity::id().
-   */
-  public function id() {
-    return $this->format;
-  }
-
-  /**
    * Overrides Drupal\Core\Entity\Entity::__construct()
    */
   public function __construct(array $values, $entity_type) {
diff --git a/core/modules/file/lib/Drupal/file/Entity/File.php b/core/modules/file/lib/Drupal/file/Entity/File.php
index 62a754b..104c39e 100644
--- a/core/modules/file/lib/Drupal/file/Entity/File.php
+++ b/core/modules/file/lib/Drupal/file/Entity/File.php
@@ -48,13 +48,6 @@ class File extends ContentEntityBase implements FileInterface {
   /**
    * {@inheritdoc}
    */
-  public function id() {
-    return $this->get('fid')->value;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
   public function getFilename() {
     return $this->get('filename')->value;
   }
diff --git a/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php b/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php
index fb6292b..3c2a5ec 100644
--- a/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php
+++ b/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php
@@ -136,13 +136,6 @@ class FilterFormat extends ConfigEntityBase implements FilterFormatInterface {
   /**
    * {@inheritdoc}
    */
-  public function id() {
-    return $this->format;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
   public function filters($instance_id = NULL) {
     if (!isset($this->filterBag)) {
       $this->filterBag = new FilterBag(\Drupal::service('plugin.manager.filter'), $this->filters);
diff --git a/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php b/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php
index 506f660..14cedd6 100644
--- a/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php
+++ b/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php
@@ -90,13 +90,6 @@ class ImageStyle extends ConfigEntityBase implements ImageStyleInterface {
   protected $effectsBag;
 
   /**
-   * Overrides Drupal\Core\Entity\Entity::id().
-   */
-  public function id() {
-    return $this->name;
-  }
-
-  /**
    * {@inheritdoc}
    */
   public function postSave(EntityStorageControllerInterface $storage_controller, $update = TRUE) {
diff --git a/core/modules/node/lib/Drupal/node/Entity/Node.php b/core/modules/node/lib/Drupal/node/Entity/Node.php
index 017e89c..dd07482 100644
--- a/core/modules/node/lib/Drupal/node/Entity/Node.php
+++ b/core/modules/node/lib/Drupal/node/Entity/Node.php
@@ -63,13 +63,6 @@
 class Node extends ContentEntityBase implements NodeInterface {
 
   /**
-   * Implements Drupal\Core\Entity\EntityInterface::id().
-   */
-  public function id() {
-    return $this->get('nid')->value;
-  }
-
-  /**
    * Overrides Drupal\Core\Entity\Entity::getRevisionId().
    */
   public function getRevisionId() {
diff --git a/core/modules/node/lib/Drupal/node/Entity/NodeType.php b/core/modules/node/lib/Drupal/node/Entity/NodeType.php
index 2b36eb5..49d068d 100644
--- a/core/modules/node/lib/Drupal/node/Entity/NodeType.php
+++ b/core/modules/node/lib/Drupal/node/Entity/NodeType.php
@@ -137,13 +137,6 @@ class NodeType extends ConfigEntityBase implements NodeTypeInterface {
   /**
    * {@inheritdoc}
    */
-  public function id() {
-    return $this->type;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
   public function getModuleSettings($module) {
     if (isset($this->settings[$module]) && is_array($this->settings[$module])) {
       return $this->settings[$module];
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php
index 32e0e9c..78275fb 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php
@@ -120,13 +120,6 @@ class Term extends ContentEntityBase implements TermInterface {
   public $parent;
 
   /**
-   * Implements Drupal\Core\Entity\EntityInterface::id().
-   */
-  public function id() {
-    return $this->get('tid')->value;
-  }
-
-  /**
    * {@inheritdoc}
    */
   protected function init() {
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Vocabulary.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Vocabulary.php
index 7857c07..89bb621 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Vocabulary.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Vocabulary.php
@@ -96,13 +96,6 @@ class Vocabulary extends ConfigEntityBase implements VocabularyInterface {
   /**
    * {@inheritdoc}
    */
-  public function id() {
-    return $this->vid;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
   public function postSave(EntityStorageControllerInterface $storage_controller, $update = TRUE) {
     parent::postSave($storage_controller, $update);
 
diff --git a/core/modules/user/lib/Drupal/user/Entity/User.php b/core/modules/user/lib/Drupal/user/Entity/User.php
index f9db482..432aa36 100644
--- a/core/modules/user/lib/Drupal/user/Entity/User.php
+++ b/core/modules/user/lib/Drupal/user/Entity/User.php
@@ -54,13 +54,6 @@ class User extends ContentEntityBase implements UserInterface {
   /**
    * {@inheritdoc}
    */
-  public function id() {
-    return $this->get('uid')->value;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
   public function isNew() {
     return !empty($this->enforceIsNew) || $this->id() === NULL;
   }
