diff --git a/core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php b/core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php
index 879762d..2e7190d 100644
--- a/core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php
+++ b/core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php
@@ -25,6 +25,13 @@ class DefaultTableMapping implements TableMappingInterface {
   protected $fieldStorageDefinitions = [];
 
   /**
+   * The prefix to be used by all the tables of this mapping.
+   *
+   * @var string
+   */
+  protected $prefix;
+
+  /**
    * The base table of the entity.
    *
    * @var string
@@ -112,22 +119,26 @@ class DefaultTableMapping implements TableMappingInterface {
    * @param \Drupal\Core\Field\FieldStorageDefinitionInterface[] $storage_definitions
    *   A list of field storage definitions that should be available for the
    *   field columns of this table mapping.
+   * @param string $prefix
+   *   (optional) A prefix to be used by all the tables of this mapping.
+   *   Defaults to an empty string.
    */
-  public function __construct(ContentEntityTypeInterface $entity_type, array $storage_definitions) {
+  public function __construct(ContentEntityTypeInterface $entity_type, array $storage_definitions, $prefix = '') {
     $this->entityType = $entity_type;
     $this->fieldStorageDefinitions = $storage_definitions;
+    $this->prefix = $prefix;
 
     // @todo Remove table names from the entity type definition in
     //   https://www.drupal.org/node/2232465.
-    $this->baseTable = $entity_type->getBaseTable() ?: $entity_type->id();
+    $this->baseTable = $this->prefix . $entity_type->getBaseTable() ?: $entity_type->id();
     if ($entity_type->isRevisionable()) {
-      $this->revisionTable = $entity_type->getRevisionTable() ?: $entity_type->id() . '_revision';
+      $this->revisionTable = $this->prefix . $entity_type->getRevisionTable() ?: $entity_type->id() . '_revision';
     }
     if ($entity_type->isTranslatable()) {
-      $this->dataTable = $entity_type->getDataTable() ?: $entity_type->id() . '_field_data';
+      $this->dataTable = $this->prefix . $entity_type->getDataTable() ?: $entity_type->id() . '_field_data';
     }
     if ($entity_type->isRevisionable() && $entity_type->isTranslatable()) {
-      $this->revisionDataTable = $entity_type->getRevisionDataTable() ?: $entity_type->id() . '_field_revision';
+      $this->revisionDataTable = $this->prefix . $entity_type->getRevisionDataTable() ?: $entity_type->id() . '_field_revision';
     }
   }
 
@@ -543,7 +554,7 @@ public function getDedicatedRevisionTableName(FieldStorageDefinitionInterface $s
    */
   protected function generateFieldTableName(FieldStorageDefinitionInterface $storage_definition, $revision) {
     $separator = $revision ? '_revision__' : '__';
-    $table_name = $storage_definition->getTargetEntityTypeId() . $separator . $storage_definition->getName();
+    $table_name = $this->prefix . $storage_definition->getTargetEntityTypeId() . $separator . $storage_definition->getName();
     // Limit the string to 48 characters, keeping a 16 characters margin for db
     // prefixes.
     if (strlen($table_name) > 48) {
