diff --git a/core/authorize.php b/core/authorize.php
index d703b33..c77cfa5 100644
--- a/core/authorize.php
+++ b/core/authorize.php
@@ -70,7 +70,7 @@ require_once DRUPAL_ROOT . '/core/includes/module.inc';
 require_once DRUPAL_ROOT . '/core/includes/ajax.inc';
 
 // We prepare only a minimal bootstrap. This includes the database and
-// variables, however, so we have access to the class autoloader registry.
+// variables, however, so we have access to the class autoloader.
 drupal_bootstrap(DRUPAL_BOOTSTRAP_SESSION);
 
 // This must go after drupal_bootstrap(), which unsets globals!
diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index f65ab4c..41fd5b3 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -254,16 +254,6 @@ const CHECK_PLAIN = 0;
 const PASS_THROUGH = -1;
 
 /**
- * Signals that the registry lookup cache should be reset.
- */
-const REGISTRY_RESET_LOOKUP_CACHE = 1;
-
-/**
- * Signals that the registry lookup cache should be written to storage.
- */
-const REGISTRY_WRITE_LOOKUP_CACHE = 2;
-
-/**
  * Regular expression to match PHP function names.
  *
  * @see http://php.net/manual/language.functions.php
@@ -2271,13 +2261,6 @@ function _drupal_bootstrap_database() {
   // Initialize the database system. Note that the connection
   // won't be initialized until it is actually requested.
   require_once DRUPAL_ROOT . '/core/includes/database.inc';
-
-  // Register autoload functions so that we can access classes and interfaces.
-  // The database autoload routine comes first so that we can load the database
-  // system without hitting the database. That is especially important during
-  // the install or upgrade process.
-  spl_autoload_register('drupal_autoload_class');
-  spl_autoload_register('drupal_autoload_interface');
 }
 
 /**
@@ -2814,11 +2797,6 @@ function ip_address() {
 }
 
 /**
- * @ingroup registry
- * @{
- */
-
-/**
  * Initializes and returns the class loader.
  *
  * The class loader is responsible for lazy-loading all PSR-0 compatible
@@ -2892,167 +2870,6 @@ function drupal_classloader_register($name, $path) {
 }
 
 /**
- * Confirms that an interface is available.
- *
- * This function is rarely called directly. Instead, it is registered as an
- * spl_autoload()  handler, and PHP calls it for us when necessary.
- *
- * @param $interface
- *   The name of the interface to check or load.
- *
- * @return
- *   TRUE if the interface is currently available, FALSE otherwise.
- */
-function drupal_autoload_interface($interface) {
-  return _registry_check_code('interface', $interface);
-}
-
-/**
- * Confirms that a class is available.
- *
- * This function is rarely called directly. Instead, it is registered as an
- * spl_autoload()  handler, and PHP calls it for us when necessary.
- *
- * @param $class
- *   The name of the class to check or load.
- *
- * @return
- *   TRUE if the class is currently available, FALSE otherwise.
- */
-function drupal_autoload_class($class) {
-  return _registry_check_code('class', $class);
-}
-
-/**
- * Checks for a resource in the registry.
- *
- * @param $type
- *   The type of resource we are looking up, or one of the constants
- *   REGISTRY_RESET_LOOKUP_CACHE or REGISTRY_WRITE_LOOKUP_CACHE, which
- *   signal that we should reset or write the cache, respectively.
- * @param $name
- *   The name of the resource, or NULL if either of the REGISTRY_* constants
- *   is passed in.
- *
- * @return
- *   TRUE if the resource was found, FALSE if not.
- *   NULL if either of the REGISTRY_* constants is passed in as $type.
- */
-function _registry_check_code($type, $name = NULL) {
-  static $lookup_cache, $cache_update_needed;
-
-  if ($type == 'class' && class_exists($name) || $type == 'interface' && interface_exists($name)) {
-    return TRUE;
-  }
-
-  if (!isset($lookup_cache)) {
-    $lookup_cache = array();
-    if ($cache = cache('bootstrap')->get('lookup_cache')) {
-      $lookup_cache = $cache->data;
-    }
-  }
-
-  // When we rebuild the registry, we need to reset this cache so
-  // we don't keep lookups for resources that changed during the rebuild.
-  if ($type == REGISTRY_RESET_LOOKUP_CACHE) {
-    $cache_update_needed = TRUE;
-    $lookup_cache = NULL;
-    return;
-  }
-
-  // Called from drupal_page_footer, we write to permanent storage if there
-  // changes to the lookup cache for this request.
-  if ($type == REGISTRY_WRITE_LOOKUP_CACHE) {
-    if ($cache_update_needed) {
-      cache('bootstrap')->set('lookup_cache', $lookup_cache);
-    }
-    return;
-  }
-
-  // $type is either 'interface' or 'class', so we only need the first letter to
-  // keep the cache key unique.
-  $cache_key = $type[0] . $name;
-  if (isset($lookup_cache[$cache_key])) {
-    if ($lookup_cache[$cache_key]) {
-      require_once DRUPAL_ROOT . '/' . $lookup_cache[$cache_key];
-    }
-    return (bool) $lookup_cache[$cache_key];
-  }
-
-  // This function may get called when the default database is not active, but
-  // there is no reason we'd ever want to not use the default database for
-  // this query.
-  $file = Database::getConnection('default', 'default')->query("SELECT filename FROM {registry} WHERE name = :name AND type = :type", array(
-      ':name' => $name,
-      ':type' => $type,
-    ))
-    ->fetchField();
-
-  // Flag that we've run a lookup query and need to update the cache.
-  $cache_update_needed = TRUE;
-
-  // Misses are valuable information worth caching, so cache even if
-  // $file is FALSE.
-  $lookup_cache[$cache_key] = $file;
-
-  if ($file) {
-    require_once DRUPAL_ROOT . '/' . $file;
-    return TRUE;
-  }
-  else {
-    return FALSE;
-  }
-}
-
-/**
- * Rescans all enabled modules and rebuilds the registry.
- *
- * Rescans all code in modules or includes directories, storing the location of
- * each interface or class in the database.
- */
-function registry_rebuild() {
-  system_rebuild_module_data();
-  registry_update();
-}
-
-/**
- * Updates the registry based on the latest files listed in the database.
- *
- * This function should be used when system_rebuild_module_data() does not need
- * to be called, because it is already known that the list of files in the
- * {system} table matches those in the file system.
- *
- * @return
- *   TRUE if the registry was rebuilt, FALSE if another thread was rebuilding
- *   in parallel and the current thread just waited for completion.
- *
- * @see registry_rebuild()
- */
-function registry_update() {
-  // install_system_module() calls module_enable() which calls into this
-  // function during initial system installation, so the lock system is neither
-  // loaded nor does its storage exist yet.
-  $in_installer = drupal_installation_attempted();
-  if (!$in_installer && !lock_acquire(__FUNCTION__)) {
-    // Another request got the lock, wait for it to finish.
-    lock_wait(__FUNCTION__);
-    return FALSE;
-  }
-
-  require_once DRUPAL_ROOT . '/core/includes/registry.inc';
-  _registry_update();
-
-  if (!$in_installer) {
-    lock_release(__FUNCTION__);
-  }
-  return TRUE;
-}
-
-/**
- * @} End of "ingroup registry".
- */
-
-/**
  * Provides central static variable storage.
  *
  * All functions requiring a static variable to persist or cache data within
diff --git a/core/includes/common.inc b/core/includes/common.inc
index 14154af..f8959d6 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -2636,7 +2636,6 @@ function drupal_page_footer() {
     ob_flush();
   }
 
-  _registry_check_code(REGISTRY_WRITE_LOOKUP_CACHE);
   drupal_cache_system_paths();
   module_implements_write_cache();
   system_run_automated_cron();
@@ -7340,10 +7339,8 @@ function drupal_flush_all_caches() {
   // Clear all non-drupal_static() static caches.
   // None currently; kept if any static caches need to be reset in the future.
 
-  // Update and synchronize the class registry and extension information based
-  // on current/actual code.
-  // Module data is rebuilt as part of registry_rebuild().
-  registry_rebuild();
+  // Rebuild module and theme data.
+  system_rebuild_module_data();
   system_rebuild_theme_data();
 
   // Ensure that all modules that are currently supposed to be enabled are
diff --git a/core/includes/file.inc b/core/includes/file.inc
index b476bc7..7559608 100644
--- a/core/includes/file.inc
+++ b/core/includes/file.inc
@@ -582,8 +582,8 @@ function file_save_htaccess($directory, $private = TRUE) {
  *   (deprecated) An associative array of conditions on the {file_managed}
  *   table, where the keys are the database fields and the values are the
  *   values those fields must have. Instead, it is preferable to use
- *   EntityFieldQuery to retrieve a list of entity IDs loadable by
- *   this function.
+ *   Drupal\entity\EntityFieldQuery to retrieve a list of entity IDs
+ *   loadable by this function.
  *
  * @return array
  *   An array of file objects, indexed by fid.
@@ -593,7 +593,7 @@ function file_save_htaccess($directory, $private = TRUE) {
  * @see hook_file_load()
  * @see file_load()
  * @see entity_load()
- * @see EntityFieldQuery
+ * @see Drupal\entity\EntityFieldQuery
  */
 function file_load_multiple($fids = array(), array $conditions = array()) {
   return entity_load_multiple('file', $fids, $conditions);
diff --git a/core/includes/install.inc b/core/includes/install.inc
index f278a6a..09b1ebd 100644
--- a/core/includes/install.inc
+++ b/core/includes/install.inc
@@ -155,8 +155,6 @@ function drupal_get_database_types() {
   // We define a driver as a directory in /core/includes/database that in turn
   // contains a database.inc file. That allows us to drop in additional drivers
   // without modifying the installer.
-  // Because we have no registry yet, we need to also include the install.inc
-  // file for the driver explicitly.
   require_once DRUPAL_ROOT . '/core/includes/database.inc';
   foreach (file_scan_directory(DRUPAL_ROOT . '/core/lib/Drupal/Core/Database/Driver', '/^[a-z]*$/i', array('recurse' => FALSE)) as $file) {
     if (file_exists($file->uri . '/Install/Tasks.php')) {
diff --git a/core/includes/module.inc b/core/includes/module.inc
index 6b4604a..3ec341b 100644
--- a/core/includes/module.inc
+++ b/core/includes/module.inc
@@ -465,8 +465,6 @@ function module_enable($module_list, $enable_dependencies = TRUE) {
       module_list(TRUE);
       module_implements_reset();
       _system_update_bootstrap_status();
-      // Update the registry to include it.
-      registry_update();
       // Refresh the schema to include it.
       drupal_get_schema(NULL, TRUE);
       // Update the theme registry to include it.
@@ -590,8 +588,6 @@ function module_disable($module_list, $disable_dependents = TRUE) {
     // Invoke hook_modules_disabled before disabling modules,
     // so we can still call module hooks to get information.
     module_invoke_all('modules_disabled', $invoke_modules);
-    // Update the registry to remove the newly-disabled module.
-    registry_update();
     _system_update_bootstrap_status();
     // Update the theme registry to remove the newly-disabled module.
     drupal_theme_rebuild();
diff --git a/core/includes/registry.inc b/core/includes/registry.inc
deleted file mode 100644
index 2316444..0000000
--- a/core/includes/registry.inc
+++ /dev/null
@@ -1,182 +0,0 @@
-<?php
-
-use Drupal\Core\Database\Database;
-
-/**
- * @file
- * This file contains the code registry parser engine.
- */
-
-/**
- * @defgroup registry Code registry
- * @{
- * The code registry engine.
- *
- * Drupal maintains an internal registry of all functions or classes in the
- * system, allowing it to lazy-load code files as needed (reducing the amount
- * of code that must be parsed on each request).
- */
-
-/**
- * Does the work for registry_update().
- */
-function _registry_update() {
-
-  // The registry serves as a central autoloader for all non-namespaced classes.
-  // It is backed by the database, but the database system is autoloaded using
-  // a PSR-0 class loader.  That avoids a fata circular dependency here, since
-  // the other class loader will be able to load the database for us.
-  $connection_info = Database::getConnectionInfo();
-  $driver = $connection_info['default']['driver'];
-
-  // Get current list of modules and their files.
-  $modules = db_query("SELECT * FROM {system} WHERE type = 'module'")->fetchAll();
-  // Get the list of files we are going to parse.
-  $files = array();
-  foreach ($modules as &$module) {
-    $module->info = unserialize($module->info);
-    $dir = dirname($module->filename);
-
-    // Store the module directory for use in hook_registry_files_alter().
-    $module->dir = $dir;
-
-    if ($module->status) {
-      // Add files for enabled modules to the registry.
-      foreach ($module->info['files'] as $file) {
-        $files["$dir/$file"] = array('module' => $module->name, 'weight' => $module->weight);
-      }
-    }
-  }
-
-  $transaction = db_transaction();
-  try {
-    // Allow modules to manually modify the list of files before the registry
-    // parses them. The $modules array provides the .info file information, which
-    // includes the list of files registered to each module. Any files in the
-    // list can then be added to the list of files that the registry will parse,
-    // or modify attributes of a file.
-    drupal_alter('registry_files', $files, $modules);
-    foreach (registry_get_parsed_files() as $filename => $file) {
-      // Add the hash for those files we have already parsed.
-      if (isset($files[$filename])) {
-        $files[$filename]['hash'] = $file['hash'];
-      }
-      else {
-        // Flush the registry of resources in files that are no longer on disc
-        // or are in files that no installed modules require to be parsed.
-        db_delete('registry')
-          ->condition('filename', $filename)
-          ->execute();
-        db_delete('registry_file')
-          ->condition('filename', $filename)
-          ->execute();
-      }
-    }
-    $parsed_files = _registry_parse_files($files);
-
-    $unchanged_resources = array();
-    $lookup_cache = array();
-    if ($cache = cache('bootstrap')->get('lookup_cache')) {
-      $lookup_cache = $cache->data;
-    }
-    foreach ($lookup_cache as $key => $file) {
-      // If the file for this cached resource is carried over unchanged from
-      // the last registry build, then we can safely re-cache it.
-      if ($file && in_array($file, array_keys($files)) && !in_array($file, $parsed_files)) {
-        $unchanged_resources[$key] = $file;
-      }
-    }
-    module_implements_reset();
-    _registry_check_code(REGISTRY_RESET_LOOKUP_CACHE);
-  }
-  catch (Exception $e) {
-    $transaction->rollback();
-    watchdog_exception('registry', $e);
-    throw $e;
-  }
-
-  // We have some unchanged resources, warm up the cache - no need to pay
-  // for looking them up again.
-  if (count($unchanged_resources) > 0) {
-    cache('bootstrap')->set('lookup_cache', $unchanged_resources);
-  }
-}
-
-/**
- * Return the list of files in registry_file
- */
-function registry_get_parsed_files() {
-  $files = array();
-  // We want the result as a keyed array.
-  $files = db_query("SELECT * FROM {registry_file}")->fetchAllAssoc('filename', PDO::FETCH_ASSOC);
-  return $files;
-}
-
-/**
- * Parse all files that have changed since the registry was last built, and save their function and class listings.
- *
- * @param $files
- *  The list of files to check and parse.
- */
-function _registry_parse_files($files) {
-  $parsed_files = array();
-  foreach ($files as $filename => $file) {
-    if (file_exists($filename)) {
-      $hash = hash_file('sha256', $filename);
-      if (empty($file['hash']) || $file['hash'] != $hash) {
-        $file['hash'] = $hash;
-        $parsed_files[$filename] = $file;
-      }
-    }
-  }
-  foreach ($parsed_files as $filename => $file) {
-    _registry_parse_file($filename, file_get_contents($filename), $file['module'], $file['weight']);
-    db_merge('registry_file')
-      ->key(array('filename' => $filename))
-      ->fields(array(
-        'hash' => $file['hash'],
-      ))
-      ->execute();
-  }
-  return array_keys($parsed_files);
-}
-
-/**
- * Parse a file and save its function and class listings.
- *
- * @param $filename
- *   Name of the file we are going to parse.
- * @param $contents
- *   Contents of the file we are going to parse as a string.
- * @param $module
- *   (optional) Name of the module this file belongs to.
- * @param $weight
- *   (optional) Weight of the module.
- */
-function _registry_parse_file($filename, $contents, $module = '', $weight = 0) {
-  if (preg_match_all('/^\s*(?:abstract|final)?\s*(class|interface)\s+([a-zA-Z0-9_]+)/m', $contents, $matches)) {
-    foreach ($matches[2] as $key => $name) {
-      db_merge('registry')
-        ->key(array(
-          'name' => $name,
-          'type' => $matches[1][$key],
-        ))
-        ->fields(array(
-          'filename' => $filename,
-          'module' => $module,
-          'weight' => $weight,
-        ))
-        ->execute();
-    }
-    // Delete any resources for this file where the name is not in the list
-    // we just merged in.
-    db_delete('registry')
-      ->condition('filename', $filename)
-      ->condition('name', $matches[2], 'NOT IN')
-      ->execute();
-  }
-}
-
-/**
- * @} End of "defgroup registry".
- */
diff --git a/core/lib/Drupal/Core/Database/Database.php b/core/lib/Drupal/Core/Database/Database.php
index 298c011..6a425de 100644
--- a/core/lib/Drupal/Core/Database/Database.php
+++ b/core/lib/Drupal/Core/Database/Database.php
@@ -374,8 +374,6 @@ abstract class Database {
       throw new DriverNotSpecifiedException('Driver not specified for this database connection: ' . $key);
     }
 
-    // We cannot rely on the registry yet, because the registry requires an
-    // open database connection.
     $driver_class = "Drupal\\Core\\Database\\Driver\\{$driver}\\Connection";
     $new_connection = new $driver_class(self::$databaseInfo[$key][$target]);
     $new_connection->setTarget($target);
diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module
index 79f2ecb..5b42861 100644
--- a/core/modules/comment/comment.module
+++ b/core/modules/comment/comment.module
@@ -1506,8 +1506,8 @@ function comment_delete_multiple($cids) {
  *   (deprecated) An associative array of conditions on the {comments}
  *   table, where the keys are the database fields and the values are the
  *   values those fields must have. Instead, it is preferable to use
- *   EntityFieldQuery to retrieve a list of entity IDs loadable by
- *   this function.
+ *   Drupal\entity\EntityFieldQuery to retrieve a list of entity IDs
+ *   loadable by this function.
  * @param bool $reset
  *   Whether to reset the internal static entity cache. Note that the static
  *   cache is disabled in comment_entity_info() by default.
@@ -1518,7 +1518,7 @@ function comment_delete_multiple($cids) {
  * @todo Remove $conditions in Drupal 8.
  *
  * @see entity_load()
- * @see EntityFieldQuery
+ * @see Drupal\entity\EntityFieldQuery
  */
 function comment_load_multiple($cids = array(), array $conditions = array(), $reset = FALSE) {
   return entity_load_multiple('comment', $cids, $conditions, $reset);
diff --git a/core/modules/comment/lib/Drupal/comment/Comment.php b/core/modules/comment/lib/Drupal/comment/Comment.php
index e75973f..a335d50 100644
--- a/core/modules/comment/lib/Drupal/comment/Comment.php
+++ b/core/modules/comment/lib/Drupal/comment/Comment.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\comment;
 
-use Entity;
+use Drupal\entity\Entity;
 
 /**
  * Defines the comment entity class.
diff --git a/core/modules/comment/lib/Drupal/comment/CommentStorageController.php b/core/modules/comment/lib/Drupal/comment/CommentStorageController.php
index 698fd70..2909a99 100644
--- a/core/modules/comment/lib/Drupal/comment/CommentStorageController.php
+++ b/core/modules/comment/lib/Drupal/comment/CommentStorageController.php
@@ -7,8 +7,8 @@
 
 namespace Drupal\comment;
 
-use EntityDatabaseStorageController;
-use EntityInterface;
+use Drupal\entity\EntityInterface;
+use Drupal\entity\EntityDatabaseStorageController;
 
 /**
  * Defines the controller class for comments.
diff --git a/core/modules/entity/entity.api.php b/core/modules/entity/entity.api.php
index 8f721cf..d4cdf1b 100644
--- a/core/modules/entity/entity.api.php
+++ b/core/modules/entity/entity.api.php
@@ -22,18 +22,19 @@
  *   properties of those types that the system needs to know about:
  *   - label: The human-readable name of the type.
  *   - controller class: The name of the class that is used to load the objects.
- *     The class has to implement the DrupalEntityControllerInterface interface.
- *     Leave blank to use the DrupalDefaultEntityController implementation.
- *   - base table: (used by DrupalDefaultEntityController) The name of the
+ *     The class has to implement the Drupal\entity\EntityControllerInterface
+ *     interface. Leave blank to use the Drupal\entity\EntityController
+ *     implementation.
+ *   - base table: (used by Drupal\entity\EntityController) The name of the
  *     entity type's base table.
- *   - static cache: (used by DrupalDefaultEntityController) FALSE to disable
+ *   - static cache: (used by Drupal\entity\EntityController) FALSE to disable
  *     static caching of entities during a page request. Defaults to TRUE.
  *   - field cache: (used by Field API loading and saving of field data) FALSE
  *     to disable Field API's persistent cache of field data. Only recommended
  *     if a higher level persistent cache is available for the entity type.
  *     Defaults to TRUE.
  *   - load hook: The name of the hook which should be invoked by
- *     DrupalDefaultEntityController:attachLoad(), for example 'node_load'.
+ *     Drupal\entity\EntityController::attachLoad(), for example 'node_load'.
  *   - uri callback: A function taking an entity as argument and returning the
  *     uri elements of the entity, e.g. 'path' and 'options'. The actual entity
  *     uri can be constructed by passing these elements to url().
@@ -337,9 +338,9 @@ function hook_entity_delete($entity, $type) {
 }
 
 /**
- * Alter or execute an EntityFieldQuery.
+ * Alter or execute an Drupal\entity\EntityFieldQuery.
  *
- * @param EntityFieldQuery $query
+ * @param Drupal\entity\EntityFieldQuery $query
  *   An EntityFieldQuery. One of the most important properties to be changed is
  *   EntityFieldQuery::executeCallback. If this is set to an existing function,
  *   this function will get the query as its single argument and its result
diff --git a/core/modules/entity/entity.info b/core/modules/entity/entity.info
index b15fadd..f8440cc 100644
--- a/core/modules/entity/entity.info
+++ b/core/modules/entity/entity.info
@@ -4,9 +4,6 @@ package = Core
 version = VERSION
 core = 8.x
 required = TRUE
-files[] = entity.class.inc
-files[] = entity.query.inc
-files[] = entity.controller.inc
 files[] = tests/entity_crud_hook_test.test
 files[] = tests/entity_query.test
 files[] = tests/entity.test
diff --git a/core/modules/entity/entity.module b/core/modules/entity/entity.module
index a6599eb..c167bd4 100644
--- a/core/modules/entity/entity.module
+++ b/core/modules/entity/entity.module
@@ -5,6 +5,8 @@
  * Entity API for handling entities like nodes or users.
  */
 
+use Drupal\entity\EntityMalformedException;
+
 /**
  * Implements hook_help().
  */
@@ -66,7 +68,7 @@ function entity_get_info($entity_type = NULL) {
       foreach ($entity_info as $name => $data) {
         $entity_info[$name] += array(
           'fieldable' => FALSE,
-          'controller class' => 'DrupalDefaultEntityController',
+          'controller class' => 'Drupal\entity\EntityController',
           'static cache' => TRUE,
           'field cache' => TRUE,
           'load hook' => $name . '_load',
@@ -90,7 +92,7 @@ function entity_get_info($entity_type = NULL) {
           $entity_info[$name]['bundles'] = array($name => array('label' => $entity_info[$name]['label']));
         }
         // Prepare entity schema fields SQL info for
-        // DrupalEntityControllerInterface::buildQuery().
+        // Drupal\entity\EntityControllerInterface::buildQuery().
         if (isset($entity_info[$name]['base table'])) {
           $entity_info[$name]['schema_fields_sql']['base table'] = drupal_schema_fields_sql($entity_info[$name]['base table']);
           if (isset($entity_info[$name]['revision table'])) {
@@ -204,9 +206,9 @@ function entity_create_stub_entity($entity_type, $ids) {
  *
  * @see hook_entity_info()
  * @see entity_load_multiple()
- * @see DrupalEntityControllerInterface
- * @see DrupalDefaultEntityController
- * @see EntityFieldQuery
+ * @see Drupal\entity\EntityControllerInterface
+ * @see Drupal\entity\EntityController
+ * @see Drupal\entity\EntityFieldQuery
  */
 function entity_load($entity_type, $id, $reset = FALSE) {
   $entities = entity_load_multiple($entity_type, array($id), array(), $reset);
@@ -221,13 +223,13 @@ function entity_load($entity_type, $id, $reset = FALSE) {
  * database access if loaded again during the same page request.
  *
  * The actual loading is done through a class that has to implement the
- * DrupalEntityControllerInterface interface. By default,
- * DrupalDefaultEntityController is used. Entity types can specify that a
- * different class should be used by setting the 'controller class' key in
- * hook_entity_info(). These classes can either implement the
- * DrupalEntityControllerInterface interface, or, most commonly, extend the
- * DrupalDefaultEntityController class. See node_entity_info() and the
- * NodeController in node.module as an example.
+ * Drupal\entity\EntityControllerInterface interface. By default,
+ * Drupal\entity\EntityController is used. Entity types can specify
+ * that a different class should be used by setting the 'controller class' key
+ * in hook_entity_info(). These classes can either implement the
+ * Drupal\entity\EntityControllerInterface interface, or, most
+ * commonly, extend the Drupal\entity\EntityController class. See
+ * node_entity_info() and the NodeController in node.module as an example.
  *
  * @param string $entity_type
  *   The entity type to load, e.g. node or user.
@@ -247,9 +249,9 @@ function entity_load($entity_type, $id, $reset = FALSE) {
  * @todo Remove $conditions in Drupal 8.
  *
  * @see hook_entity_info()
- * @see DrupalEntityControllerInterface
- * @see DrupalDefaultEntityController
- * @see EntityFieldQuery
+ * @see Drupal\entity\EntityControllerInterface
+ * @see Drupal\entity\EntityController
+ * @see Drupal\entity\EntityFieldQuery
  */
 function entity_load_multiple($entity_type, $ids = FALSE, $conditions = array(), $reset = FALSE) {
   if ($reset) {
@@ -301,7 +303,7 @@ function entity_delete_multiple($entity_type, $ids) {
  *   An array of values to set, keyed by property name. If the entity type has
  *   bundles the bundle key has to be specified.
  *
- * @return EntityInterface
+ * @return Drupal\entity\EntityInterface
  *   A new entity object.
  */
 function entity_create($entity_type, array $values) {
@@ -311,7 +313,7 @@ function entity_create($entity_type, array $values) {
 /**
  * Gets the entity controller class for an entity type.
  *
- * @return EntityStorageControllerInterface
+ * @return Drupal\entity\EntityStorageControllerInterface
  */
 function entity_get_controller($entity_type) {
   $controllers = &drupal_static(__FUNCTION__, array());
@@ -495,8 +497,3 @@ function entity_form_submit_build_entity($entity_type, $entity, $form, &$form_st
     field_attach_submit($entity_type, $entity, $form, $form_state);
   }
 }
-
-/**
- * Defines an exception thrown when a malformed entity is passed.
- */
-class EntityMalformedException extends Exception { }
diff --git a/core/modules/entity/entity.class.inc b/core/modules/entity/lib/Drupal/entity/Entity.php
similarity index 60%
rename from core/modules/entity/entity.class.inc
rename to core/modules/entity/lib/Drupal/entity/Entity.php
index 9a00718..f0f5a76 100644
--- a/core/modules/entity/entity.class.inc
+++ b/core/modules/entity/lib/Drupal/entity/Entity.php
@@ -2,185 +2,10 @@
 
 /**
  * @file
- * Provides an interface and a base class for entities.
+ * Definition of Drupal\entity\Entity.
  */
 
-/**
- * Defines a common interface for all entity objects.
- */
-interface EntityInterface {
-
-  /**
-   * Constructs a new entity object.
-   *
-   * @param $values
-   *   An array of values to set, keyed by property name. If the entity type
-   *   has bundles, the bundle key has to be specified.
-   * @param $entity_type
-   *   The type of the entity to create.
-   */
-  public function __construct(array $values, $entity_type);
-
-  /**
-   * Returns the entity identifier (the entity's machine name or numeric ID).
-   *
-   * @return
-   *   The identifier of the entity, or NULL if the entity does not yet have
-   *   an identifier.
-   */
-  public function id();
-
-  /**
-   * Returns whether the entity is new.
-   *
-   * Usually an entity is new if no ID exists for it yet. However, entities may
-   * be enforced to be new with existing IDs too.
-   *
-   * @return
-   *   TRUE if the entity is new, or FALSE if the entity has already been saved.
-   *
-   * @see EntityInterface::enforceIsNew()
-   */
-  public function isNew();
-
-  /**
-   * Enforces an entity to be new.
-   *
-   * Allows migrations to create entities with pre-defined IDs by forcing the
-   * entity to be new before saving.
-   *
-   * @param bool $value
-   *   (optional) Whether the entity should be forced to be new. Defaults to
-   *   TRUE.
-   *
-   * @see EntityInterface::isNew()
-   */
-  public function enforceIsNew($value = TRUE);
-
-  /**
-   * Returns the type of the entity.
-   *
-   * @return
-   *   The type of the entity.
-   */
-  public function entityType();
-
-  /**
-   * Returns the bundle of the entity.
-   *
-   * @return
-   *   The bundle of the entity. Defaults to the entity type if the entity type
-   *   does not make use of different bundles.
-   */
-  public function bundle();
-
-  /**
-   * Returns the label of the entity.
-   *
-   * @return
-   *   The label of the entity, or NULL if there is no label defined.
-   */
-  public function label();
-
-  /**
-   * Returns the URI elements of the entity.
-   *
-   * @return
-   *   An array containing the 'path' and 'options' keys used to build the URI
-   *   of the entity, and matching the signature of url(). NULL if the entity
-   *   has no URI of its own.
-   */
-  public function uri();
-
-  /**
-   * Returns the default language of a language-specific entity.
-   *
-   * @return
-   *   The language object of the entity's default language, or FALSE if the
-   *   entity is not language-specific.
-   *
-   * @see EntityInterface::translations()
-   */
-  public function language();
-
-  /**
-   * Returns the languages the entity is translated to.
-   *
-   * @return
-   *   An array of language objects, keyed by language codes.
-   *
-   * @see EntityInterface::language()
-   */
-  public function translations();
-
-  /**
-   * Returns the value of an entity property.
-   *
-   * @param $property_name
-   *   The name of the property to return; e.g., 'title'.
-   * @param $langcode
-   *   (optional) If the property is translatable, the language code of the
-   *   language that should be used for getting the property. If set to NULL,
-   *   the entity's default language is being used.
-   *
-   * @return
-   *   The property value, or NULL if it is not defined.
-   *
-   * @see EntityInterface::language()
-   */
-  public function get($property_name, $langcode = NULL);
-
-  /**
-   * Sets the value of an entity property.
-   *
-   * @param $property_name
-   *   The name of the property to set; e.g., 'title'.
-   * @param $value
-   *   The value to set, or NULL to unset the property.
-   * @param $langcode
-   *   (optional) If the property is translatable, the language code of the
-   *   language that should be used for getting the property. If set to
-   *   NULL, the entity's default language is being used.
-   *
-   * @see EntityInterface::language()
-   */
-  public function set($property_name, $value, $langcode = NULL);
-
-  /**
-   * Saves an entity permanently.
-   *
-   * @return
-   *   Either SAVED_NEW or SAVED_UPDATED, depending on the operation performed.
-   *
-   * @throws EntityStorageException
-   *   In case of failures an exception is thrown.
-   */
-  public function save();
-
-  /**
-   * Deletes an entity permanently.
-   *
-   * @throws EntityStorageException
-   *   In case of failures an exception is thrown.
-   */
-  public function delete();
-
-  /**
-   * Creates a duplicate of the entity.
-   *
-   * @return EntityInterface
-   *   A clone of the current entity with all identifiers unset, so saving
-   *   it inserts a new entity into the storage system.
-   */
-  public function createDuplicate();
-
-  /**
-   * Returns the info of the type of the entity.
-   *
-   * @see entity_get_info()
-   */
-  public function entityInfo();
-}
+namespace Drupal\entity;
 
 /**
  * Defines a base entity class.
diff --git a/core/modules/entity/entity.controller.inc b/core/modules/entity/lib/Drupal/entity/EntityController.php
similarity index 60%
rename from core/modules/entity/entity.controller.inc
rename to core/modules/entity/lib/Drupal/entity/EntityController.php
index 60a1e5f..3ef0fcb 100644
--- a/core/modules/entity/entity.controller.inc
+++ b/core/modules/entity/lib/Drupal/entity/EntityController.php
@@ -2,62 +2,22 @@
 
 /**
  * @file
- * Entity API controller classes and interface.
+ * Definition of Drupal\entity\EntityController.
  */
 
-/**
- * Defines a common interface for entity controller classes.
- *
- * All entity controller classes specified via the 'controller class' key
- * returned by hook_entity_info() or hook_entity_info_alter() have to implement
- * this interface.
- *
- * Most simple, SQL-based entity controllers will do better by extending
- * DrupalDefaultEntityController instead of implementing this interface
- * directly.
- */
-interface DrupalEntityControllerInterface {
-
-  /**
-   * Constructs a new DrupalEntityControllerInterface object.
-   *
-   * @param $entityType
-   *   The entity type for which the instance is created.
-   */
-  public function __construct($entityType);
+namespace Drupal\entity;
 
-  /**
-   * Resets the internal, static entity cache.
-   *
-   * @param $ids
-   *   (optional) If specified, the cache is reset for the entities with the
-   *   given ids only.
-   */
-  public function resetCache(array $ids = NULL);
-
-  /**
-   * Loads one or more entities.
-   *
-   * @param $ids
-   *   An array of entity IDs, or FALSE to load all entities.
-   * @param $conditions
-   *   An array of conditions in the form 'field' => $value.
-   *
-   * @return
-   *   An array of entity objects indexed by their ids.
-   */
-  public function load($ids = array(), $conditions = array());
-}
+use PDO;
 
 /**
  * Defines a base entity controller class.
  *
- * Default implementation of DrupalEntityControllerInterface.
+ * Default implementation of Drupal\entity\EntityControllerInterface.
  *
  * This class can be used as-is by most simple entity types. Entity types
  * requiring special handling can extend the class.
  */
-class DrupalDefaultEntityController implements DrupalEntityControllerInterface {
+class EntityController implements EntityControllerInterface {
 
   /**
    * Static cache of entities.
@@ -85,7 +45,7 @@ class DrupalDefaultEntityController implements DrupalEntityControllerInterface {
   /**
    * Additional arguments to pass to hook_TYPE_load().
    *
-   * Set before calling DrupalDefaultEntityController::attachLoad().
+   * Set before calling Drupal\entity\EntityController::attachLoad().
    *
    * @var array
    */
@@ -124,7 +84,7 @@ class DrupalDefaultEntityController implements DrupalEntityControllerInterface {
   protected $cache;
 
   /**
-   * Implements DrupalEntityControllerInterface::__construct().
+   * Implements Drupal\entity\EntityController::__construct().
    *
    * Sets basic variables.
    */
@@ -149,7 +109,7 @@ class DrupalDefaultEntityController implements DrupalEntityControllerInterface {
   }
 
   /**
-   * Implements DrupalEntityControllerInterface::resetCache().
+   * Implements Drupal\entity\EntityControllerInterface::resetCache().
    */
   public function resetCache(array $ids = NULL) {
     if (isset($ids)) {
@@ -163,7 +123,7 @@ class DrupalDefaultEntityController implements DrupalEntityControllerInterface {
   }
 
   /**
-   * Implements DrupalEntityControllerInterface::load().
+   * Implements Drupal\entity\EntityControllerInterface::load().
    */
   public function load($ids = array(), $conditions = array()) {
     $entities = array();
@@ -204,7 +164,7 @@ class DrupalDefaultEntityController implements DrupalEntityControllerInterface {
       if (!empty($this->entityInfo['entity class'])) {
         // We provide the necessary arguments for PDO to create objects of the
         // specified entity class.
-        // @see EntityInterface::__construct()
+        // @see Drupal\entity\EntityInterface::__construct()
         $query_result->setFetchMode(PDO::FETCH_CLASS, $this->entityInfo['entity class'], array(array(), $this->entityType));
       }
       $queried_entities = $query_result->fetchAllAssoc($this->idKey);
@@ -397,199 +357,3 @@ class DrupalDefaultEntityController implements DrupalEntityControllerInterface {
     $this->entityCache += $entities;
   }
 }
-
-/**
- * Defines a common interface for entity storage controllers.
- */
-interface EntityStorageControllerInterface extends DrupalEntityControllerInterface {
-
-  /**
-   * Constructs a new entity object, without permanently saving it.
-   *
-   * @param $values
-   *   An array of values to set, keyed by property name. If the entity type has
-   *   bundles the bundle key has to be specified.
-   *
-   * @return EntityInterface
-   *   A new entity object.
-   */
-  public function create(array $values);
-
-  /**
-   * Deletes permanently saved entities.
-   *
-   * @param $ids
-   *   An array of entity IDs.
-   *
-   * @throws EntityStorageException
-   *   In case of failures, an exception is thrown.
-   */
-  public function delete($ids);
-
-  /**
-   * Saves the entity permanently.
-   *
-   * @param EntityInterface $entity
-   *   The entity to save.
-   *
-   * @return
-   *   SAVED_NEW or SAVED_UPDATED is returned depending on the operation
-   *   performed.
-   *
-   * @throws EntityStorageException
-   *   In case of failures, an exception is thrown.
-   */
-  public function save(EntityInterface $entity);
-
-}
-
-/**
- * Defines an exception thrown when storage operations fail.
- */
-class EntityStorageException extends Exception { }
-
-/**
- * Implements the entity storage controller interface for the database.
- */
-class EntityDatabaseStorageController extends DrupalDefaultEntityController implements EntityStorageControllerInterface {
-
-  /**
-   * Implements EntityStorageControllerInterface::create().
-   */
-  public function create(array $values) {
-    $class = isset($this->entityInfo['entity class']) ? $this->entityInfo['entity class'] : 'Entity';
-    return new $class($values, $this->entityType);
-  }
-
-  /**
-   * Implements EntityStorageControllerInterface::delete().
-   */
-  public function delete($ids) {
-    $entities = $ids ? $this->load($ids) : FALSE;
-    if (!$entities) {
-      // If no IDs or invalid IDs were passed, do nothing.
-      return;
-    }
-    $transaction = db_transaction();
-
-    try {
-      $this->preDelete($entities);
-      foreach ($entities as $id => $entity) {
-        $this->invokeHook('predelete', $entity);
-      }
-      $ids = array_keys($entities);
-
-      db_delete($this->entityInfo['base table'])
-        ->condition($this->idKey, $ids, 'IN')
-        ->execute();
-      // Reset the cache as soon as the changes have been applied.
-      $this->resetCache($ids);
-
-      $this->postDelete($entities);
-      foreach ($entities as $id => $entity) {
-        $this->invokeHook('delete', $entity);
-      }
-      // Ignore slave server temporarily.
-      db_ignore_slave();
-    }
-    catch (Exception $e) {
-      $transaction->rollback();
-      watchdog_exception($this->entityType, $e);
-      throw new EntityStorageException($e->getMessage, $e->getCode, $e);
-    }
-  }
-
-  /**
-   * Implements EntityStorageControllerInterface::save().
-   */
-  public function save(EntityInterface $entity) {
-    $transaction = db_transaction();
-    try {
-      // Load the stored entity, if any.
-      if (!$entity->isNew() && !isset($entity->original)) {
-        $entity->original = entity_load_unchanged($this->entityType, $entity->id());
-      }
-
-      $this->preSave($entity);
-      $this->invokeHook('presave', $entity);
-
-      if (!$entity->isNew()) {
-        $return = drupal_write_record($this->entityInfo['base table'], $entity, $this->idKey);
-        $this->resetCache(array($entity->{$this->idKey}));
-        $this->postSave($entity, TRUE);
-        $this->invokeHook('update', $entity);
-      }
-      else {
-        $return = drupal_write_record($this->entityInfo['base table'], $entity);
-        // Reset general caches, but keep caches specific to certain entities.
-        $this->resetCache(array());
-
-        $entity->enforceIsNew(FALSE);
-        $this->postSave($entity, FALSE);
-        $this->invokeHook('insert', $entity);
-      }
-
-      // Ignore slave server temporarily.
-      db_ignore_slave();
-      unset($entity->original);
-
-      return $return;
-    }
-    catch (Exception $e) {
-      $transaction->rollback();
-      watchdog_exception($this->entityType, $e);
-      throw new EntityStorageException($e->getMessage(), $e->getCode(), $e);
-    }
-  }
-
-  /**
-   * Acts on an entity before the presave hook is invoked.
-   *
-   * Used before the entity is saved and before invoking the presave hook.
-   */
-  protected function preSave(EntityInterface $entity) { }
-
-  /**
-   * Acts on a saved entity before the insert or update hook is invoked.
-   *
-   * Used after the entity is saved, but before invoking the insert or update
-   * hook.
-   *
-   * @param $update
-   *   (bool) TRUE if the entity has been updated, or FALSE if it has been
-   *   inserted.
-   */
-  protected function postSave(EntityInterface $entity, $update) { }
-
-  /**
-   * Acts on entities before they are deleted.
-   *
-   * Used before the entities are deleted and before invoking the delete hook.
-   */
-  protected function preDelete($entities) { }
-
-  /**
-   * Acts on deleted entities before the delete hook is invoked.
-   *
-   * Used after the entities are deleted but before invoking the delete hook.
-   */
-  protected function postDelete($entities) { }
-
-  /**
-   * Invokes a hook on behalf of the entity.
-   *
-   * @param $hook
-   *   One of 'presave', 'insert', 'update', 'predelete', or 'delete'.
-   * @param $entity
-   *   The entity object.
-   */
-  protected function invokeHook($hook, EntityInterface $entity) {
-    if (!empty($this->entityInfo['fieldable']) && function_exists($function = 'field_attach_' . $hook)) {
-      $function($this->entityType, $entity);
-    }
-    // Invoke the hook.
-    module_invoke_all($this->entityType . '_' . $hook, $entity);
-    // Invoke the respective entity-level hook.
-    module_invoke_all('entity_' . $hook, $entity, $this->entityType);
-  }
-}
diff --git a/core/modules/entity/lib/Drupal/entity/EntityControllerInterface.php b/core/modules/entity/lib/Drupal/entity/EntityControllerInterface.php
new file mode 100644
index 0000000..f413e6c
--- /dev/null
+++ b/core/modules/entity/lib/Drupal/entity/EntityControllerInterface.php
@@ -0,0 +1,52 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\entity\EntityControllerInterface.
+ */
+
+namespace Drupal\entity;
+
+/**
+ * Defines a common interface for entity controller classes.
+ *
+ * All entity controller classes specified via the 'controller class' key
+ * returned by hook_entity_info() or hook_entity_info_alter() have to implement
+ * this interface.
+ *
+ * Most simple, SQL-based entity controllers will do better by extending
+ * Drupal\entity\EntityController instead of implementing this interface
+ * directly.
+ */
+interface EntityControllerInterface {
+
+  /**
+   * Constructs a new DrupalEntityControllerInterface object.
+   *
+   * @param $entityType
+   *   The entity type for which the instance is created.
+   */
+  public function __construct($entityType);
+
+  /**
+   * Resets the internal, static entity cache.
+   *
+   * @param $ids
+   *   (optional) If specified, the cache is reset for the entities with the
+   *   given ids only.
+   */
+  public function resetCache(array $ids = NULL);
+
+  /**
+   * Loads one or more entities.
+   *
+   * @param $ids
+   *   An array of entity IDs, or FALSE to load all entities.
+   * @param $conditions
+   *   An array of conditions in the form 'field' => $value.
+   *
+   * @return
+   *   An array of entity objects indexed by their ids.
+   */
+  public function load($ids = array(), $conditions = array());
+}
diff --git a/core/modules/entity/lib/Drupal/entity/EntityDatabaseStorageController.php b/core/modules/entity/lib/Drupal/entity/EntityDatabaseStorageController.php
new file mode 100644
index 0000000..13a529a
--- /dev/null
+++ b/core/modules/entity/lib/Drupal/entity/EntityDatabaseStorageController.php
@@ -0,0 +1,154 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\entity\EntityDatabaseStorageController.
+ */
+
+namespace Drupal\entity;
+
+/**
+ * Implements the entity storage controller interface for the database.
+ */
+class EntityDatabaseStorageController extends EntityController implements EntityStorageControllerInterface {
+
+  /**
+   * Implements Drupal\entity\EntityStorageControllerInterface::create().
+   */
+  public function create(array $values) {
+    $class = isset($this->entityInfo['entity class']) ? $this->entityInfo['entity class'] : 'Drupal\entity\Entity';
+    return new $class($values, $this->entityType);
+  }
+
+  /**
+   * Implements Drupal\entity\EntityStorageControllerInterface::delete().
+   */
+  public function delete($ids) {
+    $entities = $ids ? $this->load($ids) : FALSE;
+    if (!$entities) {
+      // If no IDs or invalid IDs were passed, do nothing.
+      return;
+    }
+    $transaction = db_transaction();
+
+    try {
+      $this->preDelete($entities);
+      foreach ($entities as $id => $entity) {
+        $this->invokeHook('predelete', $entity);
+      }
+      $ids = array_keys($entities);
+
+      db_delete($this->entityInfo['base table'])
+        ->condition($this->idKey, $ids, 'IN')
+        ->execute();
+      // Reset the cache as soon as the changes have been applied.
+      $this->resetCache($ids);
+
+      $this->postDelete($entities);
+      foreach ($entities as $id => $entity) {
+        $this->invokeHook('delete', $entity);
+      }
+      // Ignore slave server temporarily.
+      db_ignore_slave();
+    }
+    catch (Exception $e) {
+      $transaction->rollback();
+      watchdog_exception($this->entityType, $e);
+      throw new EntityStorageException($e->getMessage, $e->getCode, $e);
+    }
+  }
+
+  /**
+   * Implements Drupal\entity\EntityStorageControllerInterface::save().
+   */
+  public function save(EntityInterface $entity) {
+    $transaction = db_transaction();
+    try {
+      // Load the stored entity, if any.
+      if (!$entity->isNew() && !isset($entity->original)) {
+        $entity->original = entity_load_unchanged($this->entityType, $entity->id());
+      }
+
+      $this->preSave($entity);
+      $this->invokeHook('presave', $entity);
+
+      if (!$entity->isNew()) {
+        $return = drupal_write_record($this->entityInfo['base table'], $entity, $this->idKey);
+        $this->resetCache(array($entity->{$this->idKey}));
+        $this->postSave($entity, TRUE);
+        $this->invokeHook('update', $entity);
+      }
+      else {
+        $return = drupal_write_record($this->entityInfo['base table'], $entity);
+        // Reset general caches, but keep caches specific to certain entities.
+        $this->resetCache(array());
+
+        $entity->enforceIsNew(FALSE);
+        $this->postSave($entity, FALSE);
+        $this->invokeHook('insert', $entity);
+      }
+
+      // Ignore slave server temporarily.
+      db_ignore_slave();
+      unset($entity->original);
+
+      return $return;
+    }
+    catch (Exception $e) {
+      $transaction->rollback();
+      watchdog_exception($this->entityType, $e);
+      throw new EntityStorageException($e->getMessage(), $e->getCode(), $e);
+    }
+  }
+
+  /**
+   * Acts on an entity before the presave hook is invoked.
+   *
+   * Used before the entity is saved and before invoking the presave hook.
+   */
+  protected function preSave(EntityInterface $entity) { }
+
+  /**
+   * Acts on a saved entity before the insert or update hook is invoked.
+   *
+   * Used after the entity is saved, but before invoking the insert or update
+   * hook.
+   *
+   * @param $update
+   *   (bool) TRUE if the entity has been updated, or FALSE if it has been
+   *   inserted.
+   */
+  protected function postSave(EntityInterface $entity, $update) { }
+
+  /**
+   * Acts on entities before they are deleted.
+   *
+   * Used before the entities are deleted and before invoking the delete hook.
+   */
+  protected function preDelete($entities) { }
+
+  /**
+   * Acts on deleted entities before the delete hook is invoked.
+   *
+   * Used after the entities are deleted but before invoking the delete hook.
+   */
+  protected function postDelete($entities) { }
+
+  /**
+   * Invokes a hook on behalf of the entity.
+   *
+   * @param $hook
+   *   One of 'presave', 'insert', 'update', 'predelete', or 'delete'.
+   * @param $entity
+   *   The entity object.
+   */
+  protected function invokeHook($hook, EntityInterface $entity) {
+    if (!empty($this->entityInfo['fieldable']) && function_exists($function = 'field_attach_' . $hook)) {
+      $function($this->entityType, $entity);
+    }
+    // Invoke the hook.
+    module_invoke_all($this->entityType . '_' . $hook, $entity);
+    // Invoke the respective entity-level hook.
+    module_invoke_all('entity_' . $hook, $entity, $this->entityType);
+  }
+}
diff --git a/core/modules/entity/entity.query.inc b/core/modules/entity/lib/Drupal/entity/EntityFieldQuery.php
similarity index 93%
rename from core/modules/entity/entity.query.inc
rename to core/modules/entity/lib/Drupal/entity/EntityFieldQuery.php
index 840108a..852dced 100644
--- a/core/modules/entity/entity.query.inc
+++ b/core/modules/entity/lib/Drupal/entity/EntityFieldQuery.php
@@ -1,20 +1,15 @@
 <?php
 
-use Drupal\Core\Database\Query\Select;
-
 /**
  * @file
- * Entity query API.
+ * Definition of Drupal\entity\EntityFieldQuery.
  */
 
-/**
- * Exception thrown by EntityFieldQuery() on unsupported query syntax.
- *
- * Some storage modules might not support the full range of the syntax for
- * conditions, and will raise an EntityFieldQueryException when an unsupported
- * condition was specified.
- */
-class EntityFieldQueryException extends Exception {}
+namespace Drupal\entity;
+
+use Drupal\entity\EntityFieldQueryException;
+use Drupal\Core\Database\Query\Select;
+use PagerDefault;
 
 /**
  * Retrieves entities matching a given set of conditions.
@@ -49,7 +44,7 @@ class EntityFieldQuery {
   /**
    * Indicates that both deleted and non-deleted fields should be returned.
    *
-   * @see EntityFieldQuery::deleted()
+   * @see Drupal\entity\EntityFieldQuery::deleted()
    */
   const RETURN_ALL = NULL;
 
@@ -68,7 +63,7 @@ class EntityFieldQuery {
    *
    * @var array
    *
-   * @see EntityFieldQuery::entityCondition()
+   * @see Drupal\entity\EntityFieldQuery::entityCondition()
    */
   public $entityConditions = array();
 
@@ -77,7 +72,7 @@ class EntityFieldQuery {
    *
    * @var array
    *
-   * @see EntityFieldQuery::fieldCondition()
+   * @see Drupal\entity\EntityFieldQuery::fieldCondition()
    */
   public $fieldConditions = array();
 
@@ -91,8 +86,8 @@ class EntityFieldQuery {
    *
    * @var array
    *
-   * @see EntityFieldQuery::fieldLanguageCondition()
-   * @see EntityFieldQuery::fieldDeltaCondition()
+   * @see Drupal\entity\EntityFieldQuery::fieldLanguageCondition()
+   * @see Drupal\entity\EntityFieldQuery::fieldDeltaCondition()
    */
   public $fieldMetaConditions = array();
 
@@ -101,7 +96,7 @@ class EntityFieldQuery {
    *
    * @var array
    *
-   * @see EntityFieldQuery::propertyCondition()
+   * @see Drupal\entity\EntityFieldQuery::propertyCondition()
    */
   public $propertyConditions = array();
 
@@ -117,7 +112,7 @@ class EntityFieldQuery {
    *
    * @var array
    *
-   * @see EntityFieldQuery::range()
+   * @see Drupal\entity\EntityFieldQuery::range()
    */
   public $range = array();
 
@@ -126,7 +121,7 @@ class EntityFieldQuery {
    *
    * @var array
    *
-   * @see EntityFieldQuery::pager()
+   * @see Drupal\entity\EntityFieldQuery::pager()
    */
   public $pager = array();
 
@@ -136,7 +131,7 @@ class EntityFieldQuery {
    * TRUE to return only deleted data, FALSE to return only non-deleted data,
    * EntityFieldQuery::RETURN_ALL to return everything.
    *
-   * @see EntityFieldQuery::deleted()
+   * @see Drupal\entity\EntityFieldQuery::deleted()
    */
   public $deleted = FALSE;
 
@@ -164,7 +159,7 @@ class EntityFieldQuery {
    *
    * @var int
    *
-   * @see EntityFieldQuery::age()
+   * @see Drupal\entity\EntityFieldQuery::age()
    */
   public $age = FIELD_LOAD_CURRENT;
 
@@ -173,7 +168,7 @@ class EntityFieldQuery {
    *
    * @var array
    *
-   * @see EntityFieldQuery::addTag()
+   * @see Drupal\entity\EntityFieldQuery::addTag()
    */
   public $tags = array();
 
@@ -182,7 +177,7 @@ class EntityFieldQuery {
    *
    * @var array
    *
-   * @see EntityFieldQuery::addMetaData()
+   * @see Drupal\entity\EntityFieldQuery::addMetaData()
    */
   public $metaData = array();
 
@@ -191,7 +186,7 @@ class EntityFieldQuery {
    *
    * @var array
    *
-   * @see EntityFieldQuery::execute().
+   * @see Drupal\entity\EntityFieldQuery::execute().
    */
   public $orderedResults = array();
 
@@ -200,7 +195,7 @@ class EntityFieldQuery {
    *
    * @var string
    *
-   * @see EntityFieldQuery::execute().
+   * @see Drupal\entity\EntityFieldQuery::execute()
    */
   public $executeCallback = '';
 
@@ -240,7 +235,7 @@ class EntityFieldQuery {
    *   The operator can be omitted, and will default to 'IN' if the value is an
    *   array, or to '=' otherwise.
    *
-   * @return EntityFieldQuery
+   * @return Drupal\entity\EntityFieldQuery
    *   The called object.
    */
   public function entityCondition($name, $value, $operator = NULL) {
@@ -269,11 +264,11 @@ class EntityFieldQuery {
    *   An arbitrary identifier: conditions in the same group must have the same
    *   $langcode_group.
    *
-   * @return EntityFieldQuery
+   * @return Drupal\entity\EntityFieldQuery
    *   The called object.
    *
-   * @see EntityFieldQuery::addFieldCondition
-   * @see EntityFieldQuery::deleted
+   * @see Drupal\entity\EntityFieldQuery::addFieldCondition()
+   * @see Drupal\entity\EntityFieldQuery::deleted()
    */
   public function fieldCondition($field, $column = NULL, $value = NULL, $operator = NULL, $delta_group = NULL, $langcode_group = NULL) {
     return $this->addFieldCondition($this->fieldConditions, $field, $column, $value, $operator, $delta_group, $langcode_group);
@@ -295,11 +290,11 @@ class EntityFieldQuery {
    *   An arbitrary identifier: conditions in the same group must have the same
    *   $langcode_group.
    *
-   * @return EntityFieldQuery
+   * @return Drupal\entity\EntityFieldQuery
    *   The called object.
    *
-   * @see EntityFieldQuery::addFieldCondition
-   * @see EntityFieldQuery::deleted
+   * @see Drupal\entity\EntityFieldQuery::addFieldCondition()
+   * @see Drupal\entity\EntityFieldQuery::deleted()
    */
   public function fieldLanguageCondition($field, $value = NULL, $operator = NULL, $delta_group = NULL, $langcode_group = NULL) {
     return $this->addFieldCondition($this->fieldMetaConditions, $field, 'langcode', $value, $operator, $delta_group, $langcode_group);
@@ -321,11 +316,11 @@ class EntityFieldQuery {
    *   An arbitrary identifier: conditions in the same group must have the same
    *   $langcode_group.
    *
-   * @return EntityFieldQuery
+   * @return Drupal\entity\EntityFieldQuery
    *   The called object.
    *
-   * @see EntityFieldQuery::addFieldCondition
-   * @see EntityFieldQuery::deleted
+   * @see Drupal\entity\EntityFieldQuery::addFieldCondition()
+   * @see Drupal\entity\EntityFieldQuery::deleted()
    */
   public function fieldDeltaCondition($field, $value = NULL, $operator = NULL, $delta_group = NULL, $langcode_group = NULL) {
     return $this->addFieldCondition($this->fieldMetaConditions, $field, 'delta', $value, $operator, $delta_group, $langcode_group);
@@ -371,7 +366,7 @@ class EntityFieldQuery {
    *   An arbitrary identifier: conditions in the same group must have the same
    *   $langcode_group.
    *
-   * @return EntityFieldQuery
+   * @return Drupal\entity\EntityFieldQuery
    *   The called object.
    */
   protected function addFieldCondition(&$conditions, $field, $column = NULL, $value = NULL, $operator = NULL, $delta_group = NULL, $langcode_group = NULL) {
@@ -425,7 +420,7 @@ class EntityFieldQuery {
    *   The operator can be omitted, and will default to 'IN' if the value is an
    *   array, or to '=' otherwise.
    *
-   * @return EntityFieldQuery
+   * @return Drupal\entity\EntityFieldQuery
    *   The called object.
    */
   public function propertyCondition($column, $value, $operator = NULL) {
@@ -451,7 +446,7 @@ class EntityFieldQuery {
    * @param $direction
    *   The direction to sort. Legal values are "ASC" and "DESC".
    *
-   * @return EntityFieldQuery
+   * @return Drupal\entity\EntityFieldQuery
    *   The called object.
    */
   public function entityOrderBy($name, $direction = 'ASC') {
@@ -477,7 +472,7 @@ class EntityFieldQuery {
    * @param $direction
    *   The direction to sort. Legal values are "ASC" and "DESC".
    *
-   * @return EntityFieldQuery
+   * @return Drupal\entity\EntityFieldQuery
    *   The called object.
    */
   public function fieldOrderBy($field, $column, $direction = 'ASC') {
@@ -518,7 +513,7 @@ class EntityFieldQuery {
    * @param $direction
    *   The direction to sort. Legal values are "ASC" and "DESC".
    *
-   * @return EntityFieldQuery
+   * @return Drupal\entity\EntityFieldQuery
    *   The called object.
    */
   public function propertyOrderBy($column, $direction = 'ASC') {
@@ -533,7 +528,7 @@ class EntityFieldQuery {
   /**
    * Sets the query to be a count query only.
    *
-   * @return EntityFieldQuery
+   * @return Drupal\entity\EntityFieldQuery
    *   The called object.
    */
   public function count() {
@@ -550,7 +545,7 @@ class EntityFieldQuery {
    * @param $length
    *   The number of entities to return from the result set.
    *
-   * @return EntityFieldQuery
+   * @return Drupal\entity\EntityFieldQuery
    *   The called object.
    */
   public function range($start = NULL, $length = NULL) {
@@ -571,7 +566,7 @@ class EntityFieldQuery {
    *   An optional integer to distinguish between multiple pagers on one page.
    *   If not provided, one is automatically calculated.
    *
-   * @return EntityFieldQuery
+   * @return Drupal\entity\EntityFieldQuery
    *   The called object.
    */
   public function pager($limit = 10, $element = NULL) {
@@ -596,7 +591,7 @@ class EntityFieldQuery {
    *   An EFQ Header array based on which the order clause is added to the
    *   query.
    *
-   * @return EntityFieldQuery
+   * @return Drupal\entity\EntityFieldQuery
    *   The called object.
    */
   public function tableSort(&$headers) {
@@ -631,7 +626,7 @@ class EntityFieldQuery {
    *   TRUE to only return deleted data, FALSE to return non-deleted data,
    *   EntityFieldQuery::RETURN_ALL to return everything. Defaults to FALSE.
    *
-   * @return EntityFieldQuery
+   * @return Drupal\entity\EntityFieldQuery
    *   The called object.
    */
   public function deleted($deleted = TRUE) {
@@ -652,7 +647,7 @@ class EntityFieldQuery {
    *   - FIELD_LOAD_REVISION: Query all revisions. The results will be keyed by
    *     entity type and entity revision ID.
    *
-   * @return EntityFieldQuery
+   * @return Drupal\entity\EntityFieldQuery
    *   The called object.
    */
   public function age($age) {
@@ -677,7 +672,7 @@ class EntityFieldQuery {
    * @param string $tag
    *   The tag to add.
    *
-   * @return EntityFieldQuery
+   * @return Drupal\entity\EntityFieldQuery
    *   The called object.
    */
   public function addTag($tag) {
@@ -698,7 +693,7 @@ class EntityFieldQuery {
    * @param $object
    *   The additional data to add to the query. May be any valid PHP variable.
    *
-   * @return EntityFieldQuery
+   * @return Drupal\entity\EntityFieldQuery
    *   The called object.
    */
   public function addMetaData($key, $object) {
@@ -956,4 +951,3 @@ class EntityFieldQuery {
   }
 
 }
-
diff --git a/core/modules/entity/lib/Drupal/entity/EntityFieldQueryException.php b/core/modules/entity/lib/Drupal/entity/EntityFieldQueryException.php
new file mode 100644
index 0000000..12f2a1c
--- /dev/null
+++ b/core/modules/entity/lib/Drupal/entity/EntityFieldQueryException.php
@@ -0,0 +1,19 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\entity\EntityFieldQueryException.
+ */
+
+namespace Drupal\entity;
+
+use Exception;
+
+/**
+ * Exception thrown by EntityFieldQuery() on unsupported query syntax.
+ *
+ * Some storage modules might not support the full range of the syntax for
+ * conditions, and will raise an EntityFieldQueryException when an unsupported
+ * condition was specified.
+ */
+class EntityFieldQueryException extends Exception { }
diff --git a/core/modules/entity/lib/Drupal/entity/EntityInterface.php b/core/modules/entity/lib/Drupal/entity/EntityInterface.php
new file mode 100644
index 0000000..c4c44c2
--- /dev/null
+++ b/core/modules/entity/lib/Drupal/entity/EntityInterface.php
@@ -0,0 +1,185 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\entity\EntityInterface.
+ */
+
+namespace Drupal\entity;
+
+/**
+ * Defines a common interface for all entity objects.
+ */
+interface EntityInterface {
+
+  /**
+   * Constructs a new entity object.
+   *
+   * @param $values
+   *   An array of values to set, keyed by property name. If the entity type
+   *   has bundles, the bundle key has to be specified.
+   * @param $entity_type
+   *   The type of the entity to create.
+   */
+  public function __construct(array $values, $entity_type);
+
+  /**
+   * Returns the entity identifier (the entity's machine name or numeric ID).
+   *
+   * @return
+   *   The identifier of the entity, or NULL if the entity does not yet have
+   *   an identifier.
+   */
+  public function id();
+
+  /**
+   * Returns whether the entity is new.
+   *
+   * Usually an entity is new if no ID exists for it yet. However, entities may
+   * be enforced to be new with existing IDs too.
+   *
+   * @return
+   *   TRUE if the entity is new, or FALSE if the entity has already been saved.
+   *
+   * @see Drupal\entity\EntityInterface::enforceIsNew()
+   */
+  public function isNew();
+
+  /**
+   * Enforces an entity to be new.
+   *
+   * Allows migrations to create entities with pre-defined IDs by forcing the
+   * entity to be new before saving.
+   *
+   * @param bool $value
+   *   (optional) Whether the entity should be forced to be new. Defaults to
+   *   TRUE.
+   *
+   * @see Drupal\entity\EntityInterface::isNew()
+   */
+  public function enforceIsNew($value = TRUE);
+
+  /**
+   * Returns the type of the entity.
+   *
+   * @return
+   *   The type of the entity.
+   */
+  public function entityType();
+
+  /**
+   * Returns the bundle of the entity.
+   *
+   * @return
+   *   The bundle of the entity. Defaults to the entity type if the entity type
+   *   does not make use of different bundles.
+   */
+  public function bundle();
+
+  /**
+   * Returns the label of the entity.
+   *
+   * @return
+   *   The label of the entity, or NULL if there is no label defined.
+   */
+  public function label();
+
+  /**
+   * Returns the URI elements of the entity.
+   *
+   * @return
+   *   An array containing the 'path' and 'options' keys used to build the URI
+   *   of the entity, and matching the signature of url(). NULL if the entity
+   *   has no URI of its own.
+   */
+  public function uri();
+
+  /**
+   * Returns the default language of a language-specific entity.
+   *
+   * @return
+   *   The language object of the entity's default language, or FALSE if the
+   *   entity is not language-specific.
+   *
+   * @see Drupal\entity\EntityInterface::translations()
+   */
+  public function language();
+
+  /**
+   * Returns the languages the entity is translated to.
+   *
+   * @return
+   *   An array of language objects, keyed by language codes.
+   *
+   * @see Drupal\entity\EntityInterface::language()
+   */
+  public function translations();
+
+  /**
+   * Returns the value of an entity property.
+   *
+   * @param $property_name
+   *   The name of the property to return; e.g., 'title'.
+   * @param $langcode
+   *   (optional) If the property is translatable, the language code of the
+   *   language that should be used for getting the property. If set to NULL,
+   *   the entity's default language is being used.
+   *
+   * @return
+   *   The property value, or NULL if it is not defined.
+   *
+   * @see Drupal\entity\EntityInterface::language()
+   */
+  public function get($property_name, $langcode = NULL);
+
+  /**
+   * Sets the value of an entity property.
+   *
+   * @param $property_name
+   *   The name of the property to set; e.g., 'title'.
+   * @param $value
+   *   The value to set, or NULL to unset the property.
+   * @param $langcode
+   *   (optional) If the property is translatable, the language code of the
+   *   language that should be used for getting the property. If set to
+   *   NULL, the entity's default language is being used.
+   *
+   * @see Drupal\entity\EntityInterface::language()
+   */
+  public function set($property_name, $value, $langcode = NULL);
+
+  /**
+   * Saves an entity permanently.
+   *
+   * @return
+   *   Either SAVED_NEW or SAVED_UPDATED, depending on the operation performed.
+   *
+   * @throws Drupal\entity\EntityStorageException
+   *   In case of failures an exception is thrown.
+   */
+  public function save();
+
+  /**
+   * Deletes an entity permanently.
+   *
+   * @throws Drupal\entity\EntityStorageException
+   *   In case of failures an exception is thrown.
+   */
+  public function delete();
+
+  /**
+   * Creates a duplicate of the entity.
+   *
+   * @return Drupal\entity\EntityInterface
+   *   A clone of the current entity with all identifiers unset, so saving
+   *   it inserts a new entity into the storage system.
+   */
+  public function createDuplicate();
+
+  /**
+   * Returns the info of the type of the entity.
+   *
+   * @see entity_get_info()
+   */
+  public function entityInfo();
+}
diff --git a/core/modules/entity/lib/Drupal/entity/EntityMalformedException.php b/core/modules/entity/lib/Drupal/entity/EntityMalformedException.php
new file mode 100644
index 0000000..bd9b500
--- /dev/null
+++ b/core/modules/entity/lib/Drupal/entity/EntityMalformedException.php
@@ -0,0 +1,15 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\entity\EntityMalformedException.
+ */
+
+namespace Drupal\entity;
+
+use Exception;
+
+/**
+ * Defines an exception thrown when a malformed entity is passed.
+ */
+class EntityMalformedException extends Exception { }
diff --git a/core/modules/entity/lib/Drupal/entity/EntityStorageControllerInterface.php b/core/modules/entity/lib/Drupal/entity/EntityStorageControllerInterface.php
new file mode 100644
index 0000000..cacc57c
--- /dev/null
+++ b/core/modules/entity/lib/Drupal/entity/EntityStorageControllerInterface.php
@@ -0,0 +1,53 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\entity\EntityStorageControllerInterface.
+ */
+
+namespace Drupal\entity;
+
+/**
+ * Defines a common interface for entity storage controllers.
+ */
+interface EntityStorageControllerInterface extends EntityControllerInterface {
+
+  /**
+   * Constructs a new entity object, without permanently saving it.
+   *
+   * @param $values
+   *   An array of values to set, keyed by property name. If the entity type has
+   *   bundles the bundle key has to be specified.
+   *
+   * @return Drupal\entity\EntityInterface
+   *   A new entity object.
+   */
+  public function create(array $values);
+
+  /**
+   * Deletes permanently saved entities.
+   *
+   * @param $ids
+   *   An array of entity IDs.
+   *
+   * @throws Drupal\entity\EntityStorageException
+   *   In case of failures, an exception is thrown.
+   */
+  public function delete($ids);
+
+  /**
+   * Saves the entity permanently.
+   *
+   * @param Drupal\entity\EntityInterface $entity
+   *   The entity to save.
+   *
+   * @return
+   *   SAVED_NEW or SAVED_UPDATED is returned depending on the operation
+   *   performed.
+   *
+   * @throws Drupal\entity\EntityStorageException
+   *   In case of failures, an exception is thrown.
+   */
+  public function save(EntityInterface $entity);
+
+}
diff --git a/core/modules/entity/lib/Drupal/entity/EntityStorageException.php b/core/modules/entity/lib/Drupal/entity/EntityStorageException.php
new file mode 100644
index 0000000..dff3e93
--- /dev/null
+++ b/core/modules/entity/lib/Drupal/entity/EntityStorageException.php
@@ -0,0 +1,15 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\entity\EntityStorageException.
+ */
+
+namespace Drupal\entity;
+
+use Exception;
+
+/**
+ * Defines an exception thrown when storage operations fail.
+ */
+class EntityStorageException extends Exception { }
diff --git a/core/modules/entity/tests/entity.test b/core/modules/entity/tests/entity.test
index d920937..1047279 100644
--- a/core/modules/entity/tests/entity.test
+++ b/core/modules/entity/tests/entity.test
@@ -243,6 +243,6 @@ class EntityAPIInfoTestCase extends WebTestBase  {
     module_enable(array('entity_cache_test'));
     $info = variable_get('entity_cache_test');
     $this->assertEqual($info['label'], 'Entity Cache Test', 'Entity info label is correct.');
-    $this->assertEqual($info['controller class'], 'DrupalDefaultEntityController', 'Entity controller class info is correct.');
+    $this->assertEqual($info['controller class'], 'Drupal\entity\EntityController', 'Entity controller class info is correct.');
   }
 }
diff --git a/core/modules/entity/tests/entity_query.test b/core/modules/entity/tests/entity_query.test
index edcf95a..52018e4 100644
--- a/core/modules/entity/tests/entity_query.test
+++ b/core/modules/entity/tests/entity_query.test
@@ -6,9 +6,11 @@
  */
 
 use Drupal\simpletest\WebTestBase;
+use Drupal\entity\EntityFieldQuery;
+use Drupal\entity\EntityFieldQueryException;
 
 /**
- * Tests EntityFieldQuery.
+ * Tests Drupal\entity\EntityFieldQuery.
  */
 class EntityFieldQueryTestCase extends WebTestBase {
 
diff --git a/core/modules/entity/tests/modules/entity_test/entity_test.module b/core/modules/entity/tests/modules/entity_test/entity_test.module
index f6d2e3a..25def33 100644
--- a/core/modules/entity/tests/modules/entity_test/entity_test.module
+++ b/core/modules/entity/tests/modules/entity_test/entity_test.module
@@ -11,8 +11,8 @@
 function entity_test_entity_info() {
   $items['entity_test'] = array(
     'label' => t('Test entity'),
-    'entity class' => 'Entity',
-    'controller class' => 'EntityDatabaseStorageController',
+    'entity class' => 'Drupal\entity\Entity',
+    'controller class' => 'Drupal\entity\EntityDatabaseStorageController',
     'base table' => 'entity_test',
     'fieldable' => TRUE,
     'entity keys' => array(
@@ -34,7 +34,7 @@ function entity_test_entity_info() {
  * @param bool $reset
  *   A boolean indicating that the internal cache should be reset.
  *
- * @return Entity
+ * @return Drupal\entity\Entity
  *   The loaded entity object, or FALSE if the entity cannot be loaded.
  */
 function entity_test_load($id, $reset = FALSE) {
diff --git a/core/modules/field/field.api.php b/core/modules/field/field.api.php
index 44aa50b..7fce125 100644
--- a/core/modules/field/field.api.php
+++ b/core/modules/field/field.api.php
@@ -1902,18 +1902,18 @@ function hook_field_storage_delete_revision($entity_type, $entity, $fields) {
 }
 
 /**
- * Execute an EntityFieldQuery.
+ * Execute a Drupal\entity\EntityFieldQuery.
  *
  * This hook is called to find the entities having certain entity and field
  * conditions and sort them in the given field order. If the field storage
  * engine also handles property sorts and orders, it should unset those
  * properties in the called object to signal that those have been handled.
  *
- * @param EntityFieldQuery $query
+ * @param Drupal\entity\EntityFieldQuery $query
  *   An EntityFieldQuery.
  *
  * @return
- *   See EntityFieldQuery::execute() for the return values.
+ *   See Drupal\entity\EntityFieldQuery::execute() for the return values.
  */
 function hook_field_storage_query($query) {
   $groups = array();
diff --git a/core/modules/field/field.crud.inc b/core/modules/field/field.crud.inc
index 4a4842f..d85a656 100644
--- a/core/modules/field/field.crud.inc
+++ b/core/modules/field/field.crud.inc
@@ -6,6 +6,7 @@
  */
 
 use Drupal\field\FieldException;
+use Drupal\entity\EntityFieldQuery;
 
 /**
  * @defgroup field_crud Field CRUD API
diff --git a/core/modules/field/field.module b/core/modules/field/field.module
index ab67eb2..6fc85ad 100644
--- a/core/modules/field/field.module
+++ b/core/modules/field/field.module
@@ -4,6 +4,8 @@
  * Attach custom data fields to Drupal entities.
  */
 
+use Drupal\entity\EntityFieldQuery;
+
 /*
  * Load all public Field API functions. Drupal currently has no
  * mechanism for auto-loading core APIs, so we have to load them on
diff --git a/core/modules/field/modules/field_sql_storage/field_sql_storage.module b/core/modules/field/modules/field_sql_storage/field_sql_storage.module
index f9c27a8..fd2f52c 100644
--- a/core/modules/field/modules/field_sql_storage/field_sql_storage.module
+++ b/core/modules/field/modules/field_sql_storage/field_sql_storage.module
@@ -1,14 +1,16 @@
 <?php
 
-use Drupal\Core\Database\Database;
-use Drupal\Core\Database\Query\Select;
-use Drupal\field\FieldUpdateForbiddenException;
-
 /**
  * @file
  * Default implementation of the field storage API.
  */
 
+use Drupal\Core\Database\Database;
+use Drupal\Core\Database\Query\Select;
+use Drupal\entity\EntityFieldQuery;
+use Drupal\entity\EntityFieldQueryException;
+use Drupal\field\FieldUpdateForbiddenException;
+
 /**
  * Implements hook_help().
  */
@@ -612,7 +614,7 @@ function _field_sql_storage_query_join_entity(Select $select_query, $entity_type
 /**
  * Adds field (meta) conditions to the given query objects respecting groupings.
  *
- * @param EntityFieldQuery $query
+ * @param Drupal\entity\EntityFieldQuery $query
  *   The field query object to be processed.
  * @param SelectQuery $select_query
  *   The SelectQuery that should get grouping conditions.
diff --git a/core/modules/field/modules/list/list.module b/core/modules/field/modules/list/list.module
index c80773a..ec0eb66 100644
--- a/core/modules/field/modules/list/list.module
+++ b/core/modules/field/modules/list/list.module
@@ -6,6 +6,7 @@
  */
 
 use Drupal\field\FieldUpdateForbiddenException;
+use Drupal\entity\EntityFieldQuery;
 
 /**
  * Implements hook_help().
diff --git a/core/modules/field/tests/field.test b/core/modules/field/tests/field.test
index 9a850d9..ca4de1b 100644
--- a/core/modules/field/tests/field.test
+++ b/core/modules/field/tests/field.test
@@ -8,6 +8,7 @@
 use Drupal\field\FieldException;
 use Drupal\field\FieldValidationException;
 use Drupal\simpletest\WebTestBase;
+use Drupal\entity\EntityFieldQuery;
 
 /**
  * Parent class for Field API tests.
diff --git a/core/modules/field/tests/field_test.entity.inc b/core/modules/field/tests/field_test.entity.inc
index 52ed3fc..c8ad3d9 100644
--- a/core/modules/field/tests/field_test.entity.inc
+++ b/core/modules/field/tests/field_test.entity.inc
@@ -5,6 +5,8 @@
  * Defines an entity type.
  */
 
+use Drupal\entity\EntityController;
+
 /**
  * Implements hook_entity_info().
  */
@@ -478,10 +480,11 @@ function field_test_entity_nested_form_submit($form, &$form_state) {
 /**
  * Controller class for the test_entity_bundle entity type.
  *
- * This extends the DrupalDefaultEntityController class, adding required
- * special handling for bundles (since they are not stored in the database).
+ * This extends the Drupal\entity\EntityController class, adding
+ * required special handling for bundles (since they are not stored in the
+ * database).
  */
-class TestEntityBundleController extends DrupalDefaultEntityController {
+class TestEntityBundleController extends EntityController {
 
   protected function attachLoad(&$entities, $revision_id = FALSE) {
     // Add bundle information.
diff --git a/core/modules/field/tests/field_test.module b/core/modules/field/tests/field_test.module
index 205a624..a2da73c 100644
--- a/core/modules/field/tests/field_test.module
+++ b/core/modules/field/tests/field_test.module
@@ -13,6 +13,8 @@
  * test helper functions
  */
 
+use Drupal\entity\EntityFieldQuery;
+
 require_once DRUPAL_ROOT . '/core/modules/field/tests/field_test.entity.inc';
 require_once DRUPAL_ROOT . '/core/modules/field/tests/field_test.field.inc';
 require_once DRUPAL_ROOT . '/core/modules/field/tests/field_test.storage.inc';
diff --git a/core/modules/file/file.module b/core/modules/file/file.module
index 0aef8de..f31fdfa 100644
--- a/core/modules/file/file.module
+++ b/core/modules/file/file.module
@@ -5,6 +5,8 @@
  * Defines a "managed_file" Form API field and a "file" field for Field module.
  */
 
+use Drupal\entity\EntityFieldQuery;
+
 // Load all Field module hooks for File.
 require_once DRUPAL_ROOT . '/core/modules/file/file.field.inc';
 
diff --git a/core/modules/node/lib/Drupal/node/Node.php b/core/modules/node/lib/Drupal/node/Node.php
index 787358e..1655ffa 100644
--- a/core/modules/node/lib/Drupal/node/Node.php
+++ b/core/modules/node/lib/Drupal/node/Node.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\node;
 
-use Entity;
+use Drupal\entity\Entity;
 
 /**
  * Defines the node entity class.
diff --git a/core/modules/node/lib/Drupal/node/NodeStorageController.php b/core/modules/node/lib/Drupal/node/NodeStorageController.php
index 0cdca80..c4747f2 100644
--- a/core/modules/node/lib/Drupal/node/NodeStorageController.php
+++ b/core/modules/node/lib/Drupal/node/NodeStorageController.php
@@ -7,9 +7,9 @@
 
 namespace Drupal\node;
 
-use EntityDatabaseStorageController;
-use EntityInterface;
-use EntityStorageException;
+use Drupal\entity\EntityDatabaseStorageController;
+use Drupal\entity\EntityInterface;
+use Drupal\entity\EntityStorageException;
 use Exception;
 
 /**
@@ -129,7 +129,7 @@ class NodeStorageController extends EntityDatabaseStorageController {
   /**
    * Saves a node revision.
    *
-   * @param EntityInterface $node
+   * @param Drupal\entity\EntityInterface $node
    *   The node entity.
    */
   protected function saveRevision(EntityInterface $entity) {
@@ -152,7 +152,7 @@ class NodeStorageController extends EntityDatabaseStorageController {
   }
 
   /**
-   * Overrides DrupalDefaultEntityController::attachLoad().
+   * Overrides Drupal\entity\EntityController::attachLoad().
    */
   protected function attachLoad(&$nodes, $revision_id = FALSE) {
     // Create an array of nodes for each content type and pass this to the
@@ -177,7 +177,7 @@ class NodeStorageController extends EntityDatabaseStorageController {
   }
 
   /**
-   * Overrides DrupalDefaultEntityController::buildQuery().
+   * Overrides Drupal\entity\EntityController::buildQuery().
    */
   protected function buildQuery($ids, $conditions = array(), $revision_id = FALSE) {
     // Ensure that uid is taken from the {node} table,
diff --git a/core/modules/node/node.api.php b/core/modules/node/node.api.php
index ce3b784..915d906 100644
--- a/core/modules/node/node.api.php
+++ b/core/modules/node/node.api.php
@@ -529,12 +529,12 @@ function hook_node_insert(Drupal\node\Node $node) {
  * Act on nodes being loaded from the database.
  *
  * This hook is invoked during node loading, which is handled by entity_load(),
- * via classes NodeController and DrupalDefaultEntityController. After the node
- * information is read from the database or the entity cache, hook_load() is
- * invoked on the node's content type module, then field_attach_node_revision()
- * or field_attach_load() is called, then hook_entity_load() is invoked on all
- * implementing modules, and finally hook_node_load() is invoked on all
- * implementing modules.
+ * via classes NodeController and Drupal\entity\EntityController.
+ * After the node information is read from the database or the entity cache,
+ * hook_load() is invoked on the node's content type module, then
+ * field_attach_node_revision() or field_attach_load() is called, then
+ * hook_entity_load() is invoked on all implementing modules, and finally
+ * hook_node_load() is invoked on all implementing modules.
  *
  * This hook should only be used to add information that is not in the node or
  * node revisions table, not to replace information that is in these tables
@@ -1158,12 +1158,12 @@ function hook_insert(Drupal\node\Node $node) {
  * (use hook_node_load() to respond to all node loads).
  *
  * This hook is invoked during node loading, which is handled by entity_load(),
- * via classes NodeController and DrupalDefaultEntityController. After the node
- * information is read from the database or the entity cache, hook_load() is
- * invoked on the node's content type module, then field_attach_node_revision()
- * or field_attach_load() is called, then hook_entity_load() is invoked on all
- * implementing modules, and finally hook_node_load() is invoked on all
- * implementing modules.
+ * via classes NodeController and Drupal\entity\EntityController.
+ * After the node information is read from the database or the entity cache,
+ * hook_load() is invoked on the node's content type module, then
+ * field_attach_node_revision() or field_attach_load() is called, then
+ * hook_entity_load() is invoked on all implementing modules, and finally
+ * hook_node_load() is invoked on all implementing modules.
  *
  * This hook should only be used to add information that is not in the node or
  * node revisions table, not to replace information that is in these tables
diff --git a/core/modules/node/node.module b/core/modules/node/node.module
index 8dbc060..849dd86 100644
--- a/core/modules/node/node.module
+++ b/core/modules/node/node.module
@@ -912,8 +912,8 @@ function node_invoke($node, $hook, $a2 = NULL, $a3 = NULL, $a4 = NULL) {
  *   (deprecated) An associative array of conditions on the {node}
  *   table, where the keys are the database fields and the values are the
  *   values those fields must have. Instead, it is preferable to use
- *   EntityFieldQuery to retrieve a list of entity IDs loadable by
- *   this function.
+ *   Drupal\entity\EntityFieldQuery to retrieve a list of entity IDs
+ *   loadable by this function.
  * @param bool $reset
  *   (optional) Whether to reset the internal node_load() cache.
  *
@@ -923,7 +923,7 @@ function node_invoke($node, $hook, $a2 = NULL, $a3 = NULL, $a4 = NULL) {
  * @todo Remove $conditions in Drupal 8.
  *
  * @see entity_load_multiple()
- * @see EntityFieldQuery
+ * @see Drupal\entity\EntityFieldQuery
  */
 function node_load_multiple($nids = array(), array $conditions = array(), $reset = FALSE) {
   return entity_load_multiple('node', $nids, $conditions, $reset);
diff --git a/core/modules/node/tests/modules/node_access_test/node_access_test.module b/core/modules/node/tests/modules/node_access_test/node_access_test.module
index cda5fdf..b6c6127 100644
--- a/core/modules/node/tests/modules/node_access_test/node_access_test.module
+++ b/core/modules/node/tests/modules/node_access_test/node_access_test.module
@@ -8,6 +8,7 @@
  */
 
 use Drupal\node\Node;
+use Drupal\entity\EntityFieldQuery;
 
 /**
  * Implements hook_node_grants().
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
index 277e97b..e4fed78 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
@@ -696,8 +696,6 @@ abstract class WebTestBase extends TestBase {
     include_once DRUPAL_ROOT . '/core/includes/install.inc';
     drupal_install_system();
 
-    $this->preloadRegistry();
-
     // Set path variables.
     variable_set('file_public_path', $this->public_files_directory);
     variable_set('file_private_path', $this->private_files_directory);
@@ -767,42 +765,6 @@ abstract class WebTestBase extends TestBase {
   }
 
   /**
-   * Preload the registry from the testing site.
-   *
-   * This method is called by Drupal\simpletest\WebTestBase::setUp(), and preloads
-   * the registry from the testing site to cut down on the time it takes to
-   * set up a clean environment for the current test run.
-   */
-  protected function preloadRegistry() {
-    // Use two separate queries, each with their own connections: copy the
-    // {registry} and {registry_file} tables over from the parent installation
-    // to the child installation.
-    $original_connection = Database::getConnection('default', 'simpletest_original_default');
-    $test_connection = Database::getConnection();
-
-    foreach (array('registry', 'registry_file') as $table) {
-      // Find the records from the parent database.
-      $source_query = $original_connection
-        ->select($table, array(), array('fetch' => PDO::FETCH_ASSOC))
-        ->fields($table);
-
-      $dest_query = $test_connection->insert($table);
-
-      $first = TRUE;
-      foreach ($source_query->execute() as $row) {
-        if ($first) {
-          $dest_query->fields(array_keys($row));
-          $first = FALSE;
-        }
-        // Insert the records into the child database.
-        $dest_query->values($row);
-      }
-
-      $dest_query->execute();
-    }
-  }
-
-  /**
    * Reset all data structures after having enabled new modules.
    *
    * This method is called by Drupal\simpletest\WebTestBase::setUp() after enabling
diff --git a/core/modules/simpletest/simpletest.module b/core/modules/simpletest/simpletest.module
index 38c360b..a80addd 100644
--- a/core/modules/simpletest/simpletest.module
+++ b/core/modules/simpletest/simpletest.module
@@ -288,13 +288,9 @@ function simpletest_log_read($test_id, $prefix, $test_class, $during_test = FALS
 /**
  * Get a list of all of the tests provided by the system.
  *
- * The list of test classes is loaded from the registry where it looks for
- * files ending in ".test". Once loaded the test list is cached and stored in
- * a static variable. In order to list tests provided by disabled modules
- * hook_registry_files_alter() is used to forcefully add them to the registry.
- *
- * PSR-0 classes are found by searching the designated directory for each module
- * for files matching the PSR-0 standard.
+ * The list of test classes is loaded by searching the designated directory 
+ * for each module for files matching the PSR-0 standard. Once loaded the 
+ * test list is cached and stored in a static variable. 
  *
  * @return
  *   An array of tests keyed with the groups specified in each of the tests
@@ -310,7 +306,6 @@ function simpletest_log_read($test_id, $prefix, $test_class, $during_test = FALS
  *       ),
  *     );
  *   @endcode
- * @see simpletest_registry_files_alter()
  */
 function simpletest_test_get_all() {
   $groups = &drupal_static(__FUNCTION__);
@@ -326,11 +321,8 @@ function simpletest_test_get_all() {
       $groups = $cache->data;
     }
     else {
-      // Select all clases in files ending with .test.
-      // @todo: Remove this once all tests have been ported to PSR-0.
-      $classes = db_query("SELECT name FROM {registry} WHERE type = :type AND filename LIKE :name", array(':type' => 'class', ':name' => '%.test'))->fetchCol();
-
       // Select all PSR-0 classes in the Tests namespace of all modules.
+      $classes = array();
       $system_list = db_query("SELECT name, filename FROM {system}")->fetchAllKeyed();
 
       foreach ($system_list as $name => $filename) {
@@ -403,29 +395,6 @@ function simpletest_classloader_register() {
 }
 
 /**
- * Implements hook_registry_files_alter().
- *
- * Add the test files for disabled modules so that we get a list containing
- * all the avialable tests.
- */
-function simpletest_registry_files_alter(&$files, $modules) {
-  foreach ($modules as $module) {
-    // Only add test files for disabled modules, as enabled modules should
-    // already include any test files they provide.
-    if (!$module->status) {
-      $dir = $module->dir;
-      if (!empty($module->info['files'])) {
-        foreach ($module->info['files'] as $file) {
-          if (substr($file, -5) == '.test') {
-            $files["$dir/$file"] = array('module' => $module->name, 'weight' => $module->weight);
-          }
-        }
-      }
-    }
-  }
-}
-
-/**
  * Generate test file.
  */
 function simpletest_generate_file($filename, $width, $lines, $type = 'binary-text') {
@@ -469,7 +438,6 @@ function simpletest_clean_environment() {
   }
 
   // Detect test classes that have been added, renamed or deleted.
-  registry_rebuild();
   cache()->delete('simpletest');
 }
 
diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php
index 0b66f2c..28253f5 100644
--- a/core/modules/system/system.api.php
+++ b/core/modules/system/system.api.php
@@ -3157,59 +3157,6 @@ function hook_disable() {
 }
 
 /**
- * Perform necessary alterations to the list of files parsed by the registry.
- *
- * Modules can manually modify the list of files before the registry parses
- * them. The $modules array provides the .info file information, which includes
- * the list of files registered to each module. Any files in the list can then
- * be added to the list of files that the registry will parse, or modify
- * attributes of a file.
- *
- * A necessary alteration made by the core SimpleTest module is to force .test
- * files provided by disabled modules into the list of files parsed by the
- * registry.
- *
- * @param $files
- *   List of files to be parsed by the registry. The list will contain
- *   files found in each enabled module's info file and the core includes
- *   directory. The array is keyed by the file path and contains an array of
- *   the related module's name and weight as used internally by
- *   _registry_update() and related functions.
- *
- *   For example:
- *   @code
- *     $files["modules/system/system.module"] = array(
- *       'module' => 'system',
- *       'weight' => 0,
- *     );
- *   @endcode
- * @param $modules
- *   An array containing all module information stored in the {system} table.
- *   Each element of the array also contains the module's .info file
- *   information in the property 'info'. An additional 'dir' property has been
- *   added to the module information which provides the path to the directory
- *   in which the module resides. The example shows how to take advantage of
- *   both properties.
- *
- * @see _registry_update()
- * @see simpletest_test_get_all()
- */
-function hook_registry_files_alter(&$files, $modules) {
-  foreach ($modules as $module) {
-    // Only add test files for disabled modules, as enabled modules should
-    // already include any test files they provide.
-    if (!$module->status) {
-      $dir = $module->dir;
-      foreach ($module->info['files'] as $file) {
-        if (substr($file, -5) == '.test') {
-          $files["$dir/$file"] = array('module' => $module->name, 'weight' => $module->weight);
-        }
-      }
-    }
-  }
-}
-
-/**
  * Return an array of tasks to be performed by an installation profile.
  *
  * Any tasks you define here will be run, in order, after the installer has
diff --git a/core/modules/system/system.install b/core/modules/system/system.install
index 83def52..ec84219 100644
--- a/core/modules/system/system.install
+++ b/core/modules/system/system.install
@@ -1399,68 +1399,6 @@ function system_schema() {
     ),
   );
 
-  $schema['registry'] = array(
-    'description' => "Each record is a function, class, or interface name and the file it is in.",
-    'fields' => array(
-      'name'   => array(
-        'description' => 'The name of the function, class, or interface.',
-        'type' => 'varchar',
-        'length' => 255,
-        'not null' => TRUE,
-        'default' => '',
-      ),
-      'type'   => array(
-        'description' => 'Either function or class or interface.',
-        'type' => 'varchar',
-        'length' => 9,
-        'not null' => TRUE,
-        'default' => '',
-      ),
-      'filename'   => array(
-        'description' => 'Name of the file.',
-        'type' => 'varchar',
-        'length' => 255,
-        'not null' => TRUE,
-      ),
-      'module' => array(
-        'description' => 'Name of the module the file belongs to.',
-        'type' => 'varchar',
-        'length' => 255,
-        'not null' => TRUE,
-        'default' => ''
-      ),
-      'weight' => array(
-        'description' => "The order in which this module's hooks should be invoked relative to other modules. Equal-weighted modules are ordered by name.",
-        'type' => 'int',
-        'not null' => TRUE,
-        'default' => 0,
-      ),
-    ),
-    'primary key' => array('name', 'type'),
-    'indexes' => array(
-      'hook' => array('type', 'weight', 'module'),
-    ),
-  );
-
-  $schema['registry_file'] = array(
-    'description' => "Files parsed to build the registry.",
-    'fields' => array(
-      'filename'   => array(
-        'description' => 'Path to the file.',
-        'type' => 'varchar',
-        'length' => 255,
-        'not null' => TRUE,
-      ),
-      'hash'  => array(
-        'description' => "sha-256 hash of the file's contents when last parsed.",
-        'type' => 'varchar',
-        'length' => 64,
-        'not null' => TRUE,
-      ),
-    ),
-    'primary key' => array('filename'),
-  );
-
   $schema['semaphore'] = array(
     'description' => 'Table for holding semaphores, locks, flags, etc. that cannot be stored as Drupal variables since they must not be cached.',
     'fields' => array(
diff --git a/core/modules/system/tests/registry.test b/core/modules/system/tests/registry.test
deleted file mode 100644
index 7ad8326..0000000
--- a/core/modules/system/tests/registry.test
+++ /dev/null
@@ -1,144 +0,0 @@
-<?php
-
-use Drupal\simpletest\WebTestBase;
-
-class RegistryParseFileTestCase extends WebTestBase {
-  public static function getInfo() {
-    return array(
-      'name' => 'Registry parse file test',
-      'description' => 'Parse a simple file and check that its resources are saved to the database.',
-      'group' => 'System'
-    );
-  }
-
-  function setUp() {
-    $chrs = hash('sha256', microtime() . mt_rand());
-    $this->fileName = 'registry_test_' . substr($chrs, 0, 16);
-    $this->className = 'registry_test_class' . substr($chrs, 16, 16);
-    $this->interfaceName = 'registry_test_interface' . substr($chrs, 32, 16);
-    parent::setUp();
-  }
-
-  /**
-   * testRegistryParseFile
-   */
-  function testRegistryParseFile() {
-    _registry_parse_file($this->fileName, $this->getFileContents());
-    foreach (array('className', 'interfaceName') as $resource) {
-      $foundName = db_query('SELECT name FROM {registry} WHERE name = :name', array(':name' => $this->$resource))->fetchField();
-      $this->assertTrue($this->$resource == $foundName, t('Resource "@resource" found.', array('@resource' => $this->$resource)));
-    }
-  }
-
-  /**
-   * getFileContents
-   */
-  function getFileContents() {
-    $file_contents = <<<CONTENTS
-<?php
-
-class {$this->className} {}
-
-interface {$this->interfaceName} {}
-
-CONTENTS;
-    return $file_contents;
-  }
-
-}
-
-class RegistryParseFilesTestCase extends WebTestBase {
-  protected $fileTypes = array('new', 'existing_changed');
-
-  public static function getInfo() {
-    return array(
-      'name' => 'Registry parse files test',
-      'description' => 'Read two a simple files from disc, and check that their resources are saved to the database.',
-      'group' => 'System'
-    );
-  }
-
-  function setUp() {
-    parent::setUp();
-    // Create files with some php to parse - one 'new', one 'existing' so
-    // we test all the important code paths in _registry_parse_files.
-    foreach ($this->fileTypes as $fileType) {
-      $chrs = hash('sha256', microtime() . mt_rand());
-      $this->$fileType = new stdClass();
-      $this->$fileType->fileName = 'public://registry_test_' . substr($chrs, 0, 16);
-      $this->$fileType->className = 'registry_test_class' . substr($chrs, 16, 16);
-      $this->$fileType->interfaceName = 'registry_test_interface' . substr($chrs, 32, 16);
-      $this->$fileType->contents = $this->getFileContents($fileType);
-      file_save_data($this->$fileType->contents, $this->$fileType->fileName);
-
-      if ($fileType == 'existing_changed') {
-        // Add a record with an incorrect hash.
-        $this->$fileType->fakeHash = hash('sha256', mt_rand());
-        db_insert('registry_file')
-          ->fields(array(
-            'hash' => $this->$fileType->fakeHash,
-            'filename' => $this->$fileType->fileName,
-          ))
-          ->execute();
-
-        // Insert some fake resource records.
-        foreach (array('class', 'interface') as $type) {
-          db_insert('registry')
-            ->fields(array(
-              'name' => $type . hash('sha256', microtime() . mt_rand()),
-              'type' => $type,
-              'filename' => $this->$fileType->fileName,
-            ))
-            ->execute();
-        }
-      }
-    }
-  }
-
-  /**
-   * testRegistryParseFiles
-   */
-  function testRegistryParseFiles() {
-    _registry_parse_files($this->getFiles());
-    foreach ($this->fileTypes as $fileType) {
-      // Test that we have all the right resources.
-      foreach (array('className', 'interfaceName') as $resource) {
-        $foundName = db_query('SELECT name FROM {registry} WHERE name = :name', array(':name' => $this->$fileType->$resource))->fetchField();
-        $this->assertTrue($this->$fileType->$resource == $foundName, t('Resource "@resource" found.', array('@resource' => $this->$fileType->$resource)));
-      }
-      // Test that we have the right hash.
-      $hash = db_query('SELECT hash FROM {registry_file} WHERE filename = :filename', array(':filename' => $this->$fileType->fileName))->fetchField();
-      $this->assertTrue(hash('sha256', $this->$fileType->contents) == $hash, t('sha-256 for "@filename" matched.' . $fileType . $hash, array('@filename' => $this->$fileType->fileName)));
-    }
-  }
-
-  /**
-   * getFiles
-   */
-  function getFiles() {
-    $files = array();
-    foreach ($this->fileTypes as $fileType) {
-      $files[$this->$fileType->fileName] = array('module' => '', 'weight' => 0);
-      if ($fileType == 'existing_changed') {
-        $files[$this->$fileType->fileName]['hash'] = $this->$fileType->fakeHash;
-      }
-    }
-    return $files;
-  }
-
-  /**
-   * getFileContents
-   */
-  function getFileContents($fileType) {
-    $file_contents = <<<CONTENTS
-<?php
-
-class {$this->$fileType->className} {}
-
-interface {$this->$fileType->interfaceName} {}
-
-CONTENTS;
-    return $file_contents;
-  }
-
-}
diff --git a/core/modules/taxonomy/taxonomy.entity.inc b/core/modules/taxonomy/taxonomy.entity.inc
index 3562580..773d62b 100644
--- a/core/modules/taxonomy/taxonomy.entity.inc
+++ b/core/modules/taxonomy/taxonomy.entity.inc
@@ -5,6 +5,10 @@
  * Entity classes and controllers for Taxonomy module.
  */
 
+use Drupal\entity\Entity;
+use Drupal\entity\EntityInterface;
+use Drupal\entity\EntityDatabaseStorageController;
+
 /**
  * Defines the taxonomy term entity.
  */
@@ -212,7 +216,7 @@ class TaxonomyTermController extends EntityDatabaseStorageController {
   }
 
   /**
-   * Implements DrupalEntityControllerInterface::resetCache().
+   * Implements Drupal\entity\EntityControllerInterface::resetCache().
    */
   public function resetCache(array $ids = NULL) {
     drupal_static_reset('taxonomy_term_count_nodes');
@@ -355,7 +359,7 @@ class TaxonomyVocabularyController extends EntityDatabaseStorageController {
   }
 
   /**
-   * Implements DrupalEntityControllerInterface::resetCache().
+   * Implements Drupal\entity\EntityControllerInterface::resetCache().
    */
   public function resetCache(array $ids = NULL) {
     drupal_static_reset('taxonomy_vocabulary_get_names');
diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module
index 024f3ed..8de8ae3 100644
--- a/core/modules/taxonomy/taxonomy.module
+++ b/core/modules/taxonomy/taxonomy.module
@@ -941,7 +941,7 @@ function taxonomy_term_load_multiple_by_name($name, $vocabulary = NULL) {
  * database access if loaded again during the same page request.
  *
  * @see entity_load_multiple()
- * @see EntityFieldQuery
+ * @see Drupal\entity\EntityFieldQuery
  *
  * @param array|bool $tids
  *   An array of taxonomy term IDs, or FALSE to load all terms.
@@ -949,8 +949,8 @@ function taxonomy_term_load_multiple_by_name($name, $vocabulary = NULL) {
  *   (deprecated) An associative array of conditions on the {taxonomy_term}
  *   table, where the keys are the database fields and the values are the
  *   values those fields must have. Instead, it is preferable to use
- *   EntityFieldQuery to retrieve a list of entity IDs loadable by
- *   this function.
+ *   Drupal\entity\EntityFieldQuery to retrieve a list of entity IDs
+ *   loadable by this function.
  *
  * @return array
  *   An array of taxonomy term entities, indexed by tid. When no results are
diff --git a/core/modules/taxonomy/taxonomy.test b/core/modules/taxonomy/taxonomy.test
index d59094c..55b30fa 100644
--- a/core/modules/taxonomy/taxonomy.test
+++ b/core/modules/taxonomy/taxonomy.test
@@ -7,6 +7,7 @@
 
 use Drupal\field\FieldValidationException;
 use Drupal\simpletest\WebTestBase;
+use Drupal\entity\EntityFieldQuery;
 
 /**
  * Provides common helper methods for Taxonomy module tests.
diff --git a/core/modules/user/lib/Drupal/user/User.php b/core/modules/user/lib/Drupal/user/User.php
index b39d88d..a64652c 100644
--- a/core/modules/user/lib/Drupal/user/User.php
+++ b/core/modules/user/lib/Drupal/user/User.php
@@ -7,10 +7,7 @@
 
 namespace Drupal\user;
 
-/**
- * @todo Switch to PSR-0 for the Entity classes: http://drupal.org/node/1495024
- */
-use Entity;
+use Drupal\entity\Entity;
 
 /**
  * Defines the user entity class.
diff --git a/core/modules/user/lib/Drupal/user/UserStorageController.php b/core/modules/user/lib/Drupal/user/UserStorageController.php
index bd0d9b9..06d7fbc 100644
--- a/core/modules/user/lib/Drupal/user/UserStorageController.php
+++ b/core/modules/user/lib/Drupal/user/UserStorageController.php
@@ -7,11 +7,9 @@
 
 namespace Drupal\user;
 
-/**
- * @todo Switch to PSR-0 for the Entity classes: http://drupal.org/node/1495024
- */
-use EntityDatabaseStorageController;
-use EntityInterface;
+use Drupal\entity\EntityInterface;
+use Drupal\entity\EntityMalformedException;
+use Drupal\entity\EntityDatabaseStorageController;
 
 /**
  * Controller class for users.
diff --git a/core/modules/user/user.module b/core/modules/user/user.module
index 836f101..0765bfb 100644
--- a/core/modules/user/user.module
+++ b/core/modules/user/user.module
@@ -273,8 +273,8 @@ function user_external_load($authname) {
  *   (deprecated) An associative array of conditions on the {users}
  *   table, where the keys are the database fields and the values are the
  *   values those fields must have. Instead, it is preferable to use
- *   EntityFieldQuery to retrieve a list of entity IDs loadable by
- *   this function.
+ *   Drupal\entity\EntityFieldQuery to retrieve a list of entity IDs
+ *   loadable by this function.
  * @param bool $reset
  *   A boolean indicating that the internal cache should be reset. Use this if
  *   loading a user object which has been altered during the page request.
@@ -286,7 +286,7 @@ function user_external_load($authname) {
  * @see user_load()
  * @see user_load_by_mail()
  * @see user_load_by_name()
- * @see EntityFieldQuery
+ * @see Drupal\entity\EntityFieldQuery
  *
  * @todo Remove $conditions in Drupal 8.
  */
