diff --git a/core/core.services.yml b/core/core.services.yml
index 7d7449df03344a11cfb8339644154880bae607f4..40c6a8a6b44e688509b5c73529ca6ed1ef49f59e 100644
--- a/core/core.services.yml
+++ b/core/core.services.yml
@@ -622,7 +622,7 @@ services:
     arguments: ['@menu.tree_storage', '@plugin.manager.menu.link', '@router.route_provider', '@menu.active_trail', '@controller_resolver']
   menu.default_tree_manipulators:
     class: Drupal\Core\Menu\DefaultMenuLinkTreeManipulators
-    arguments: ['@access_manager', '@current_user', '@entity.query']
+    arguments: ['@access_manager', '@current_user', '@entity_type.manager']
   menu.active_trail:
     class: Drupal\Core\Menu\MenuActiveTrail
     arguments: ['@plugin.manager.menu.link', '@current_route_match', '@cache.menu', '@lock']
diff --git a/core/lib/Drupal.php b/core/lib/Drupal.php
index 50027399d1178d6fd002b913572c9fb6552a3efa..de2229755ced7c2c2919beb5d2b2d934fc818337 100644
--- a/core/lib/Drupal.php
+++ b/core/lib/Drupal.php
@@ -460,7 +460,7 @@ public static function httpClient() {
    *   The query object that can query the given entity type.
    */
   public static function entityQuery($entity_type, $conjunction = 'AND') {
-    return static::getContainer()->get('entity.query')->get($entity_type, $conjunction);
+    return static::entityTypeManager()->getStorage($entity_type)->getQuery($conjunction);
   }
 
   /**
@@ -477,7 +477,7 @@ public static function entityQuery($entity_type, $conjunction = 'AND') {
    *   The query object that can query the given entity type.
    */
   public static function entityQueryAggregate($entity_type, $conjunction = 'AND') {
-    return static::getContainer()->get('entity.query')->getAggregate($entity_type, $conjunction);
+    return static::entityTypeManager()->getStorage($entity_type)->getAggregateQuery($conjunction);
   }
 
   /**
diff --git a/core/lib/Drupal/Core/Entity/Query/QueryFactory.php b/core/lib/Drupal/Core/Entity/Query/QueryFactory.php
index dd1133b7f781f4ea6a62a5585eb7367cd2809717..a3c14b277f476f99fc214d56100bdf1f989d7fde 100644
--- a/core/lib/Drupal/Core/Entity/Query/QueryFactory.php
+++ b/core/lib/Drupal/Core/Entity/Query/QueryFactory.php
@@ -14,8 +14,9 @@
  *
  * @see \Drupal\Core\Entity\EntityStorageBase::getQuery()
  *
- * @todo https://www.drupal.org/node/2389335 remove entity.query service and
- *   replace with using the entity storage's getQuery() method.
+ * @deprecated in Drupal 8.3.0, will be removed before Drupal 9.0.0. Use
+ *   \Drupal\Core\Entity\EntityStorageInterface::getQuery() or
+ *   \Drupal\Core\Entity\EntityStorageInterface::getAggregateQuery() instead.
  */
 class QueryFactory implements ContainerAwareInterface {
 
diff --git a/core/lib/Drupal/Core/Entity/entity.api.php b/core/lib/Drupal/Core/Entity/entity.api.php
index 9f6ef8b8904420af90cbda7d3c92d8021ef9bd2a..9d5132880e9ca1ea985b0f5179e534143666deb1 100644
--- a/core/lib/Drupal/Core/Entity/entity.api.php
+++ b/core/lib/Drupal/Core/Entity/entity.api.php
@@ -452,19 +452,16 @@
  * // Simple query:
  * $query = \Drupal::entityQuery('your_entity_type');
  * // Or, if you have a $container variable:
- * $query_service = $container->get('entity.query');
- * $query = $query_service->get('your_entity_type');
+ * $storage = $container->get('entity_type.manager')->getStorage('your_entity_type');
+ * $query = $storage->getQuery();
  * @endcode
  * If you need aggregation, there is an aggregate query available, which
  * implements \Drupal\Core\Entity\Query\QueryAggregateInterface:
  * @code
  * $query \Drupal::entityQueryAggregate('your_entity_type');
  * // Or:
- * $query = $query_service->getAggregate('your_entity_type');
+ * $query = $storage->getAggregateQuery('your_entity_type');
  * @endcode
- * Also, you should use dependency injection to get this object if
- * possible; the service you need is entity.query, and its methods getQuery()
- * or getAggregateQuery() will get the query object.
  *
  * In either case, you can then add conditions to your query, using methods
  * like condition(), exists(), etc. on $query; add sorting, pager, and range
diff --git a/core/lib/Drupal/Core/Menu/DefaultMenuLinkTreeManipulators.php b/core/lib/Drupal/Core/Menu/DefaultMenuLinkTreeManipulators.php
index 114bf23c02c49fb6a90a88695a058f09b2c7951c..c74e38083ff455899bb4dac2c7fc39d18ec1a62a 100644
--- a/core/lib/Drupal/Core/Menu/DefaultMenuLinkTreeManipulators.php
+++ b/core/lib/Drupal/Core/Menu/DefaultMenuLinkTreeManipulators.php
@@ -4,7 +4,7 @@
 
 use Drupal\Core\Access\AccessManagerInterface;
 use Drupal\Core\Access\AccessResult;
-use Drupal\Core\Entity\Query\QueryFactory;
+use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\node\NodeInterface;
 
@@ -34,11 +34,11 @@ class DefaultMenuLinkTreeManipulators {
   protected $account;
 
   /**
-   * The entity query factory.
+   * The entity type manager.
    *
-   * @var \Drupal\Core\Entity\Query\QueryFactory
+   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
    */
-  protected $queryFactory;
+  protected $entityTypeManager;
 
   /**
    * Constructs a \Drupal\Core\Menu\DefaultMenuLinkTreeManipulators object.
@@ -47,13 +47,13 @@ class DefaultMenuLinkTreeManipulators {
    *   The access manager.
    * @param \Drupal\Core\Session\AccountInterface $account
    *   The current user.
-   * @param \Drupal\Core\Entity\Query\QueryFactory $query_factory
-   *   The entity query factory.
+   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
+   *   The entity type manager.
    */
-  public function __construct(AccessManagerInterface $access_manager, AccountInterface $account, QueryFactory $query_factory) {
+  public function __construct(AccessManagerInterface $access_manager, AccountInterface $account, EntityTypeManagerInterface $entity_type_manager) {
     $this->accessManager = $access_manager;
     $this->account = $account;
-    $this->queryFactory = $query_factory;
+    $this->entityTypeManager = $entity_type_manager;
   }
 
   /**
@@ -135,7 +135,7 @@ public function checkNodeAccess(array $tree) {
     if ($node_links) {
       $nids = array_keys($node_links);
 
-      $query = $this->queryFactory->get('node');
+      $query = $this->entityTypeManager->getStorage('node')->getQuery();
       $query->condition('nid', $nids, 'IN');
 
       // Allows admins to view all nodes, by both disabling node_access
diff --git a/core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php b/core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php
index 7380e1daecd073db3e391ccbb33dc387f6bb905b..72e7a30892a8c98994bafff3a2867f6cb67e7dbe 100644
--- a/core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php
+++ b/core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php
@@ -7,7 +7,6 @@
 use Drupal\Core\Access\AccessResult;
 use Drupal\Core\Block\BlockBase;
 use Drupal\Core\Cache\Cache;
-use Drupal\Core\Entity\Query\QueryInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\Core\Session\AccountInterface;
@@ -38,13 +37,6 @@ class AggregatorFeedBlock extends BlockBase implements ContainerFactoryPluginInt
    */
   protected $itemStorage;
 
-  /**
-   * The entity query object for feed items.
-   *
-   * @var \Drupal\Core\Entity\Query\QueryInterface
-   */
-  protected $itemQuery;
-
   /**
    * Constructs an AggregatorFeedBlock object.
    *
@@ -58,14 +50,11 @@ class AggregatorFeedBlock extends BlockBase implements ContainerFactoryPluginInt
    *   The entity storage for feeds.
    * @param \Drupal\aggregator\ItemStorageInterface $item_storage
    *   The entity storage for feed items.
-   * @param \Drupal\Core\Entity\Query\QueryInterface $item_query
-   *   The entity query object for feed items.
    */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, FeedStorageInterface $feed_storage, ItemStorageInterface $item_storage, QueryInterface $item_query) {
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, FeedStorageInterface $feed_storage, ItemStorageInterface $item_storage) {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
     $this->feedStorage = $feed_storage;
     $this->itemStorage = $item_storage;
-    $this->itemQuery = $item_query;
   }
 
 
@@ -77,9 +66,8 @@ public static function create(ContainerInterface $container, array $configuratio
       $configuration,
       $plugin_id,
       $plugin_definition,
-      $container->get('entity.manager')->getStorage('aggregator_feed'),
-      $container->get('entity.manager')->getStorage('aggregator_item'),
-      $container->get('entity.query')->get('aggregator_item')
+      $container->get('entity_type.manager')->getStorage('aggregator_feed'),
+      $container->get('entity_type.manager')->getStorage('aggregator_item')
     );
   }
 
@@ -142,7 +130,7 @@ public function blockSubmit($form, FormStateInterface $form_state) {
   public function build() {
     // Load the selected feed.
     if ($feed = $this->feedStorage->load($this->configuration['feed'])) {
-      $result = $this->itemQuery
+      $result = $this->itemStorage->getQuery()
         ->condition('fid', $feed->id())
         ->range(0, $this->configuration['block_count'])
         ->sort('timestamp', 'DESC')
diff --git a/core/modules/aggregator/src/Plugin/aggregator/processor/DefaultProcessor.php b/core/modules/aggregator/src/Plugin/aggregator/processor/DefaultProcessor.php
index 7f6754d0d526141e8da51cdecc1f5d67ea04efc5..4469c51a6dd3e46a7cdca64f53c82f3ae0afc8f8 100644
--- a/core/modules/aggregator/src/Plugin/aggregator/processor/DefaultProcessor.php
+++ b/core/modules/aggregator/src/Plugin/aggregator/processor/DefaultProcessor.php
@@ -10,7 +10,6 @@
 use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Config\ConfigFactoryInterface;
 use Drupal\Core\Datetime\DateFormatterInterface;
-use Drupal\Core\Entity\Query\QueryInterface;
 use Drupal\Core\Form\ConfigFormBaseTrait;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
@@ -39,13 +38,6 @@ class DefaultProcessor extends AggregatorPluginSettingsBase implements Processor
    */
   protected $configFactory;
 
-  /**
-   * The entity query object for feed items.
-   *
-   * @var \Drupal\Core\Entity\Query\QueryInterface
-   */
-  protected $itemQuery;
-
   /**
    * The entity storage for items.
    *
@@ -71,17 +63,14 @@ class DefaultProcessor extends AggregatorPluginSettingsBase implements Processor
    *   The plugin implementation definition.
    * @param \Drupal\Core\Config\ConfigFactoryInterface $config
    *   The configuration factory object.
-   * @param \Drupal\Core\Entity\Query\QueryInterface $item_query
-   *   The entity query object for feed items.
    * @param \Drupal\aggregator\ItemStorageInterface $item_storage
    *   The entity storage for feed items.
    * @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter
    *   The date formatter service.
    */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, ConfigFactoryInterface $config, QueryInterface $item_query, ItemStorageInterface $item_storage, DateFormatterInterface $date_formatter) {
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, ConfigFactoryInterface $config, ItemStorageInterface $item_storage, DateFormatterInterface $date_formatter) {
     $this->configFactory = $config;
     $this->itemStorage = $item_storage;
-    $this->itemQuery = $item_query;
     $this->dateFormatter = $date_formatter;
     // @todo Refactor aggregator plugins to ConfigEntity so merging
     //   the configuration here is not needed.
@@ -97,8 +86,7 @@ public static function create(ContainerInterface $container, array $configuratio
       $plugin_id,
       $plugin_definition,
       $container->get('config.factory'),
-      $container->get('entity.query')->get('aggregator_item'),
-      $container->get('entity.manager')->getStorage('aggregator_item'),
+      $container->get('entity_type.manager')->getStorage('aggregator_item'),
       $container->get('date.formatter')
     );
   }
@@ -257,7 +245,7 @@ public function postProcess(FeedInterface $feed) {
     if ($aggregator_clear != AGGREGATOR_CLEAR_NEVER) {
       // Delete all items that are older than flush item timer.
       $age = REQUEST_TIME - $aggregator_clear;
-      $result = $this->itemQuery
+      $result = $this->itemStorage->getQuery()
         ->condition('fid', $feed->id())
         ->condition('timestamp', $age, '<')
         ->execute();
diff --git a/core/modules/block/src/Tests/NewDefaultThemeBlocksTest.php b/core/modules/block/src/Tests/NewDefaultThemeBlocksTest.php
index 9442df507378047133e7d251fc60020d15aba42c..5b4eb83563730590900936ef1f484afdfe928a37 100644
--- a/core/modules/block/src/Tests/NewDefaultThemeBlocksTest.php
+++ b/core/modules/block/src/Tests/NewDefaultThemeBlocksTest.php
@@ -45,11 +45,14 @@ function testNewDefaultThemeBlocks() {
       ->set('default', $new_theme)
       ->save();
 
+    /** @var \Drupal\Core\Entity\EntityStorageInterface $block_storage */
+    $block_storage = $this->container->get('entity_type.manager')->getStorage('block');
+
     // Ensure that the new theme has all the blocks as the previous default.
-    $default_block_names = $this->container->get('entity.query')->get('block')
+    $default_block_names = $block_storage->getQuery()
       ->condition('theme', $default_theme)
       ->execute();
-    $new_blocks = $this->container->get('entity.query')->get('block')
+    $new_blocks = $block_storage->getQuery()
       ->condition('theme', $new_theme)
       ->execute();
     $this->assertTrue(count($default_block_names) == count($new_blocks), 'The new default theme has the same number of blocks as the previous theme.');
@@ -64,7 +67,7 @@ function testNewDefaultThemeBlocks() {
     // Install a hidden base theme and ensure blocks are not copied.
     $base_theme = 'test_basetheme';
     \Drupal::service('theme_handler')->install([$base_theme]);
-    $new_blocks = $this->container->get('entity.query')->get('block')
+    $new_blocks = $block_storage->getQuery()
       ->condition('theme', $base_theme)
       ->execute();
     $this->assertTrue(empty($new_blocks), 'Installing a hidden base theme does not copy blocks from the default theme.');
diff --git a/core/modules/block_content/src/Form/BlockContentTypeDeleteForm.php b/core/modules/block_content/src/Form/BlockContentTypeDeleteForm.php
index 49ba0380f2368e4c40ee648486ac06876ae75f65..b68e695b38abcb53c3e2a26a7fa2cdbfd5e66776 100644
--- a/core/modules/block_content/src/Form/BlockContentTypeDeleteForm.php
+++ b/core/modules/block_content/src/Form/BlockContentTypeDeleteForm.php
@@ -3,46 +3,20 @@
 namespace Drupal\block_content\Form;
 
 use Drupal\Core\Entity\EntityDeleteForm;
-use Drupal\Core\Entity\Query\QueryFactory;
 use Drupal\Core\Form\FormStateInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
  * Provides a confirmation form for deleting a custom block type entity.
  */
 class BlockContentTypeDeleteForm extends EntityDeleteForm {
 
-  /**
-   * The query factory to create entity queries.
-   *
-   * @var \Drupal\Core\Entity\Query\QueryFactory
-   */
-  public $queryFactory;
-
-  /**
-   * Constructs a query factory object.
-   *
-   * @param \Drupal\Core\Entity\Query\QueryFactory $query_factory
-   *   The entity query object.
-   */
-  public function __construct(QueryFactory $query_factory) {
-    $this->queryFactory = $query_factory;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container) {
-    return new static(
-      $container->get('entity.query')
-    );
-  }
-
   /**
    * {@inheritdoc}
    */
   public function buildForm(array $form, FormStateInterface $form_state) {
-    $blocks = $this->queryFactory->get('block_content')->condition('type', $this->entity->id())->execute();
+    $blocks = $this->entityTypeManager->getStorage('block_content')->getQuery()
+      ->condition('type', $this->entity->id())
+      ->execute();
     if (!empty($blocks)) {
       $caption = '<p>' . $this->formatPlural(count($blocks), '%label is used by 1 custom block on your site. You can not remove this block type until you have removed all of the %label blocks.', '%label is used by @count custom blocks on your site. You may not remove %label until you have removed all of the %label custom blocks.', array('%label' => $this->entity->label())) . '</p>';
       $form['description'] = array('#markup' => $caption);
diff --git a/core/modules/book/book.services.yml b/core/modules/book/book.services.yml
index 73c948436f04c9e2598e9e2eff20009bbe4293bf..46fddbc4356b81ef6470abf37fffb623a401c0cb 100644
--- a/core/modules/book/book.services.yml
+++ b/core/modules/book/book.services.yml
@@ -35,5 +35,5 @@ services:
     class: Drupal\book\BookUninstallValidator
     tags:
       - { name: module_install.uninstall_validator }
-    arguments: ['@book.outline_storage', '@entity.query', '@string_translation']
+    arguments: ['@book.outline_storage', '@entity_type.manager', '@string_translation']
     lazy: true
diff --git a/core/modules/book/src/BookUninstallValidator.php b/core/modules/book/src/BookUninstallValidator.php
index 27add30528e910ce213ec8f19c3649728d4db71c..181b9f2bdf6888235f1d08a13f8d6a4152711d0d 100644
--- a/core/modules/book/src/BookUninstallValidator.php
+++ b/core/modules/book/src/BookUninstallValidator.php
@@ -2,7 +2,7 @@
 
 namespace Drupal\book;
 
-use Drupal\Core\Entity\Query\QueryFactory;
+use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Extension\ModuleUninstallValidatorInterface;
 use Drupal\Core\StringTranslation\StringTranslationTrait;
 use Drupal\Core\StringTranslation\TranslationInterface;
@@ -23,25 +23,25 @@ class BookUninstallValidator implements ModuleUninstallValidatorInterface {
   protected $bookOutlineStorage;
 
   /**
-   * The entity query for node.
+   * The entity type manager.
    *
-   * @var \Drupal\Core\Entity\Query\QueryInterface
+   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
    */
-  protected $entityQuery;
+  protected $entityTypeManager;
 
   /**
    * Constructs a new BookUninstallValidator.
    *
    * @param \Drupal\book\BookOutlineStorageInterface $book_outline_storage
    *   The book outline storage.
-   * @param \Drupal\Core\Entity\Query\QueryFactory $query_factory
-   *   The entity query factory.
+   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
+   *   The entity type manager.
    * @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
    *   The string translation service.
    */
-  public function __construct(BookOutlineStorageInterface $book_outline_storage, QueryFactory $query_factory, TranslationInterface $string_translation) {
+  public function __construct(BookOutlineStorageInterface $book_outline_storage, EntityTypeManagerInterface $entity_type_manager, TranslationInterface $string_translation) {
     $this->bookOutlineStorage = $book_outline_storage;
-    $this->entityQuery = $query_factory->get('node');
+    $this->entityTypeManager = $entity_type_manager;
     $this->stringTranslation = $string_translation;
   }
 
@@ -82,7 +82,7 @@ protected function hasBookOutlines() {
    *   TRUE if there are book nodes, FALSE otherwise.
    */
   protected function hasBookNodes() {
-    $nodes = $this->entityQuery
+    $nodes = $this->entityTypeManager->getStorage('node')->getQuery()
       ->condition('type', 'book')
       ->accessCheck(FALSE)
       ->range(0, 1)
diff --git a/core/modules/comment/comment.services.yml b/core/modules/comment/comment.services.yml
index 8d03ce5f87fd4dfaa415577f5ba841847ce9d27c..46398a06a48a9da6a5f828fefa6c56bd370bac22 100644
--- a/core/modules/comment/comment.services.yml
+++ b/core/modules/comment/comment.services.yml
@@ -7,7 +7,7 @@ services:
 
   comment.manager:
     class: Drupal\comment\CommentManager
-    arguments: ['@entity.manager', '@entity.query', '@config.factory', '@string_translation', '@url_generator', '@module_handler', '@current_user']
+    arguments: ['@entity.manager', '@config.factory', '@string_translation', '@url_generator', '@module_handler', '@current_user']
 
   comment.statistics:
     class: Drupal\comment\CommentStatistics
diff --git a/core/modules/comment/src/CommentManager.php b/core/modules/comment/src/CommentManager.php
index 828b1942839161c2de8208c27f5487d805ab5764..fb1c61e4da63ee1a61fd517c7d69e99f175a684e 100644
--- a/core/modules/comment/src/CommentManager.php
+++ b/core/modules/comment/src/CommentManager.php
@@ -7,7 +7,6 @@
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Entity\FieldableEntityInterface;
-use Drupal\Core\Entity\Query\QueryFactory;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Routing\UrlGeneratorInterface;
 use Drupal\Core\Routing\UrlGeneratorTrait;
@@ -32,13 +31,6 @@ class CommentManager implements CommentManagerInterface {
    */
   protected $entityManager;
 
-  /**
-   * The entity query factory.
-   *
-   * @var \Drupal\Core\Entity\Query\QueryFactory
-   */
-  protected $queryFactory;
-
   /**
    * Whether the \Drupal\user\RoleInterface::AUTHENTICATED_ID can post comments.
    *
@@ -72,8 +64,6 @@ class CommentManager implements CommentManagerInterface {
    *
    * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
    *   The entity manager service.
-   * @param \Drupal\Core\Entity\Query\QueryFactory $query_factory
-   *   The entity query factory.
    * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
    *   The config factory.
    * @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
@@ -85,9 +75,8 @@ class CommentManager implements CommentManagerInterface {
    * @param \Drupal\Core\Session\AccountInterface $current_user
    *   The current user.
    */
-  public function __construct(EntityManagerInterface $entity_manager, QueryFactory $query_factory, ConfigFactoryInterface $config_factory, TranslationInterface $string_translation, UrlGeneratorInterface $url_generator, ModuleHandlerInterface $module_handler, AccountInterface $current_user) {
+  public function __construct(EntityManagerInterface $entity_manager, ConfigFactoryInterface $config_factory, TranslationInterface $string_translation, UrlGeneratorInterface $url_generator, ModuleHandlerInterface $module_handler, AccountInterface $current_user) {
     $this->entityManager = $entity_manager;
-    $this->queryFactory = $query_factory;
     $this->userConfig = $config_factory->get('user.settings');
     $this->stringTranslation = $string_translation;
     $this->urlGenerator = $url_generator;
@@ -212,7 +201,7 @@ public function getCountNewComments(EntityInterface $entity, $field_name = NULL,
       $timestamp = ($timestamp > HISTORY_READ_LIMIT ? $timestamp : HISTORY_READ_LIMIT);
 
       // Use the timestamp to retrieve the number of new comments.
-      $query = $this->queryFactory->get('comment')
+      $query = $this->entityManager->getStorage('comment')->getQuery()
         ->condition('entity_type', $entity->getEntityTypeId())
         ->condition('entity_id', $entity->id())
         ->condition('created', $timestamp, '>')
diff --git a/core/modules/comment/src/Form/CommentTypeDeleteForm.php b/core/modules/comment/src/Form/CommentTypeDeleteForm.php
index daadc9293387aa74189b6b4011947578bb1e6ac5..8c3da7a20ee6d835c4e8419b64ebd00fd3902ec8 100644
--- a/core/modules/comment/src/Form/CommentTypeDeleteForm.php
+++ b/core/modules/comment/src/Form/CommentTypeDeleteForm.php
@@ -5,7 +5,6 @@
 use Drupal\comment\CommentManagerInterface;
 use Drupal\Core\Entity\EntityDeleteForm;
 use Drupal\Core\Entity\EntityManager;
-use Drupal\Core\Entity\Query\QueryFactory;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\field\Entity\FieldStorageConfig;
 use Psr\Log\LoggerInterface;
@@ -16,13 +15,6 @@
  */
 class CommentTypeDeleteForm extends EntityDeleteForm {
 
-  /**
-   * The query factory to create entity queries.
-   *
-   * @var \Drupal\Core\Entity\Query\QueryFactory
-   */
-  public $queryFactory;
-
   /**
    * The comment manager service.
    *
@@ -54,8 +46,6 @@ class CommentTypeDeleteForm extends EntityDeleteForm {
   /**
    * Constructs a query factory object.
    *
-   * @param \Drupal\Core\Entity\Query\QueryFactory $query_factory
-   *   The entity query object.
    * @param \Drupal\comment\CommentManagerInterface $comment_manager
    *   The comment manager service.
    * @param \Drupal\Core\Entity\EntityManager $entity_manager
@@ -63,8 +53,7 @@ class CommentTypeDeleteForm extends EntityDeleteForm {
    * @param \Psr\Log\LoggerInterface $logger
    *   A logger instance.
    */
-  public function __construct(QueryFactory $query_factory, CommentManagerInterface $comment_manager, EntityManager $entity_manager, LoggerInterface $logger) {
-    $this->queryFactory = $query_factory;
+  public function __construct(CommentManagerInterface $comment_manager, EntityManager $entity_manager, LoggerInterface $logger) {
     $this->commentManager = $comment_manager;
     $this->entityManager = $entity_manager;
     $this->logger = $logger;
@@ -75,7 +64,6 @@ public function __construct(QueryFactory $query_factory, CommentManagerInterface
    */
   public static function create(ContainerInterface $container) {
     return new static(
-      $container->get('entity.query'),
       $container->get('comment.manager'),
       $container->get('entity.manager'),
       $container->get('logger.factory')->get('comment')
@@ -86,7 +74,9 @@ public static function create(ContainerInterface $container) {
    * {@inheritdoc}
    */
   public function buildForm(array $form, FormStateInterface $form_state) {
-    $comments = $this->queryFactory->get('comment')->condition('comment_type', $this->entity->id())->execute();
+    $comments = $this->entityTypeManager->getStorage('comment')->getQuery()
+      ->condition('comment_type', $this->entity->id())
+      ->execute();
     $entity_type = $this->entity->getTargetEntityTypeId();
     $caption = '';
     foreach (array_keys($this->commentManager->getFields($entity_type)) as $field_name) {
diff --git a/core/modules/comment/src/Plugin/migrate/destination/EntityComment.php b/core/modules/comment/src/Plugin/migrate/destination/EntityComment.php
index e3582c5ecdfdcfb95ea837af2e2fc580bbd859a7..a3e82af61b180b7cdfca64ddfecf756314493e81 100644
--- a/core/modules/comment/src/Plugin/migrate/destination/EntityComment.php
+++ b/core/modules/comment/src/Plugin/migrate/destination/EntityComment.php
@@ -4,7 +4,6 @@
 
 use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Entity\EntityStorageInterface;
-use Drupal\Core\Entity\Query\QueryFactory;
 use Drupal\Core\Field\FieldTypePluginManagerInterface;
 use Drupal\Core\State\StateInterface;
 use Drupal\migrate\Plugin\MigrationInterface;
@@ -26,13 +25,6 @@ class EntityComment extends EntityContentBase {
    */
   protected $state;
 
-  /**
-   * The entity query object.
-   *
-   * @var \Drupal\Core\Entity\Query\QueryInterface
-   */
-  protected $entityQuery;
-
   /**
    * An array of entity IDs for the 'commented entity' keyed by entity type.
    *
@@ -61,13 +53,10 @@ class EntityComment extends EntityContentBase {
    *   The field type plugin manager service.
    * @param \Drupal\Core\State\StateInterface $state
    *   The state storage object.
-   * @param \Drupal\Core\Entity\Query\QueryFactory $entity_query
-   *   The query object that can query the given entity type.
    */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityStorageInterface $storage, array $bundles, EntityManagerInterface $entity_manager, FieldTypePluginManagerInterface $field_type_manager, StateInterface $state, QueryFactory $entity_query) {
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityStorageInterface $storage, array $bundles, EntityManagerInterface $entity_manager, FieldTypePluginManagerInterface $field_type_manager, StateInterface $state) {
     parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $storage, $bundles, $entity_manager, $field_type_manager);
     $this->state = $state;
-    $this->entityQuery = $entity_query;
   }
 
   /**
@@ -84,8 +73,7 @@ public static function create(ContainerInterface $container, array $configuratio
       array_keys($container->get('entity.manager')->getBundleInfo($entity_type)),
       $container->get('entity.manager'),
       $container->get('plugin.manager.field.field_type'),
-      $container->get('state'),
-      $container->get('entity.query')
+      $container->get('state')
     );
   }
 
diff --git a/core/modules/comment/tests/src/Unit/CommentManagerTest.php b/core/modules/comment/tests/src/Unit/CommentManagerTest.php
index f93f80772204a604a9a57e63210ae925a86c2e7a..78f14bbb1bbf60bc47762607ce152ea9b4b91496 100644
--- a/core/modules/comment/tests/src/Unit/CommentManagerTest.php
+++ b/core/modules/comment/tests/src/Unit/CommentManagerTest.php
@@ -46,7 +46,6 @@ public function testGetFields() {
 
     $comment_manager = new CommentManager(
       $entity_manager,
-      $this->getMockBuilder('Drupal\Core\Entity\Query\QueryFactory')->disableOriginalConstructor()->getMock(),
       $this->getMock('Drupal\Core\Config\ConfigFactoryInterface'),
       $this->getMock('Drupal\Core\StringTranslation\TranslationInterface'),
       $this->getMock('Drupal\Core\Routing\UrlGeneratorInterface'),
diff --git a/core/modules/config/tests/config_test/src/ConfigTestForm.php b/core/modules/config/tests/config_test/src/ConfigTestForm.php
index 8a375b81bd5a7d5332bdc5d2b67b801a749b6eb8..8384e6a66a02eaa692c7e70e7b899c15824ea7e8 100644
--- a/core/modules/config/tests/config_test/src/ConfigTestForm.php
+++ b/core/modules/config/tests/config_test/src/ConfigTestForm.php
@@ -3,42 +3,14 @@
 namespace Drupal\config_test;
 
 use Drupal\Core\Entity\EntityForm;
-use Drupal\Core\Entity\Query\QueryFactory;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Language\LanguageInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
  * Form controller for the test config edit forms.
  */
 class ConfigTestForm extends EntityForm {
 
-  /**
-   * The entity query.
-   *
-   * @var \Drupal\Core\Entity\Query\QueryFactory
-   */
-  protected $entityQuery;
-
-  /**
-   * Constructs a new ConfigTestForm.
-   *
-   * @param \Drupal\Core\Entity\Query\QueryFactory $entity_query
-   *   The entity query.
-   */
-  public function __construct(QueryFactory $entity_query) {
-    $this->entityQuery = $entity_query;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container) {
-    return new static(
-      $container->get('entity.query')
-    );
-  }
-
   /**
    * {@inheritdoc}
    */
@@ -189,7 +161,8 @@ public function save(array $form, FormStateInterface $form_state) {
   public function exists($entity_id, array $element, FormStateInterface $form_state) {
     /** @var \Drupal\Core\Config\Entity\ConfigEntityInterface $entity */
     $entity = $form_state->getFormObject()->getEntity();
-    return (bool) $this->entityQuery->get($entity->getEntityTypeId())
+    return (bool) $this->entityTypeManager->getStorage($entity->getEntityTypeId())
+      ->getQuery()
       ->condition($entity->getEntityType()->getKey('id'), $entity_id)
       ->execute();
   }
diff --git a/core/modules/field_ui/src/Form/EntityDisplayModeFormBase.php b/core/modules/field_ui/src/Form/EntityDisplayModeFormBase.php
index 9befdba178deef95abceedcfbb5f1860cf8bbb52..7a566418085543185ebcac85e9c4e1eb1a998e91 100644
--- a/core/modules/field_ui/src/Form/EntityDisplayModeFormBase.php
+++ b/core/modules/field_ui/src/Form/EntityDisplayModeFormBase.php
@@ -3,23 +3,13 @@
 namespace Drupal\field_ui\Form;
 
 use Drupal\Core\Entity\EntityForm;
-use Drupal\Core\Entity\EntityManagerInterface;
-use Drupal\Core\Entity\Query\QueryFactory;
 use Drupal\Core\Form\FormStateInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
  * Provides the generic base class for entity display mode forms.
  */
 abstract class EntityDisplayModeFormBase extends EntityForm {
 
-  /**
-   * The entity query factory.
-   *
-   * @var \Drupal\Core\Entity\Query\QueryFactory
-   */
-  protected $queryFactory;
-
   /**
    * The entity type definition.
    *
@@ -27,42 +17,12 @@ abstract class EntityDisplayModeFormBase extends EntityForm {
    */
   protected $entityType;
 
-  /**
-   * The entity manager.
-   *
-   * @var \Drupal\Component\Plugin\PluginManagerInterface
-   */
-  protected $entityManager;
-
-  /**
-   * Constructs a new EntityDisplayModeFormBase.
-   *
-   * @param \Drupal\Core\Entity\Query\QueryFactory $query_factory
-   *   The entity query factory.
-   * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
-   *   The entity manager.
-   */
-  public function __construct(QueryFactory $query_factory, EntityManagerInterface $entity_manager) {
-    $this->queryFactory = $query_factory;
-    $this->entityManager = $entity_manager;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container) {
-    return new static(
-      $container->get('entity.query'),
-      $container->get('entity.manager')
-    );
-  }
-
   /**
    * {@inheritdoc}
    */
   protected function init(FormStateInterface $form_state) {
     parent::init($form_state);
-    $this->entityType = $this->entityManager->getDefinition($this->entity->getEntityTypeId());
+    $this->entityType = $this->entityTypeManager->getDefinition($this->entity->getEntityTypeId());
   }
 
   /**
@@ -107,8 +67,9 @@ public function exists($entity_id, array $element) {
     if ($entity_id == 'default') {
       return TRUE;
     }
-    return (bool) $this->queryFactory
-      ->get($this->entity->getEntityTypeId())
+    return (bool) $this->entityTypeManager
+      ->getStorage($this->entity->getEntityTypeId())
+      ->getQuery()
       ->condition('id', $element['#field_prefix'] . $entity_id)
       ->execute();
   }
diff --git a/core/modules/field_ui/src/Form/FieldStorageAddForm.php b/core/modules/field_ui/src/Form/FieldStorageAddForm.php
index 5b37d78534bad96817e651aac7a58fb8e13083f0..231fd63a179cc9f9bfd63fa4f4a2055644973a8a 100644
--- a/core/modules/field_ui/src/Form/FieldStorageAddForm.php
+++ b/core/modules/field_ui/src/Form/FieldStorageAddForm.php
@@ -3,7 +3,6 @@
 namespace Drupal\field_ui\Form;
 
 use Drupal\Core\Config\ConfigFactoryInterface;
-use Drupal\Core\Entity\Query\QueryFactory;
 use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Field\FieldTypePluginManagerInterface;
 use Drupal\Core\Form\FormBase;
@@ -46,13 +45,6 @@ class FieldStorageAddForm extends FormBase {
    */
   protected $fieldTypePluginManager;
 
-  /**
-   * The query factory to create entity queries.
-   *
-   * @var \Drupal\Core\Entity\Query\QueryFactory
-   */
-  public $queryFactory;
-
   /**
    * The configuration factory.
    *
@@ -67,15 +59,12 @@ class FieldStorageAddForm extends FormBase {
    *   The entity manager.
    * @param \Drupal\Core\Field\FieldTypePluginManagerInterface $field_type_plugin_manager
    *   The field type plugin manager.
-   * @param \Drupal\Core\Entity\Query\QueryFactory $query_factory
-   *   The entity query factory.
    * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
    *   The configuration factory.
    */
-  public function __construct(EntityManagerInterface $entity_manager, FieldTypePluginManagerInterface $field_type_plugin_manager, QueryFactory $query_factory, ConfigFactoryInterface $config_factory) {
+  public function __construct(EntityManagerInterface $entity_manager, FieldTypePluginManagerInterface $field_type_plugin_manager, ConfigFactoryInterface $config_factory) {
     $this->entityManager = $entity_manager;
     $this->fieldTypePluginManager = $field_type_plugin_manager;
-    $this->queryFactory = $query_factory;
     $this->configFactory = $config_factory;
   }
 
@@ -93,7 +82,6 @@ public static function create(ContainerInterface $container) {
     return new static(
       $container->get('entity.manager'),
       $container->get('plugin.manager.field.field_type'),
-      $container->get('entity.query'),
       $container->get('config.factory')
     );
   }
@@ -505,7 +493,7 @@ protected function getExistingFieldStorageOptions() {
   protected function getExistingFieldLabels(array $field_names) {
     // Get all the fields corresponding to the given field storage names and
     // this entity type.
-    $field_ids = $this->queryFactory->get('field_config')
+    $field_ids = $this->entityManager->getStorage('field_config')->getQuery()
       ->condition('entity_type', $this->entityTypeId)
       ->condition('field_name', $field_names)
       ->execute();
diff --git a/core/modules/file/src/Plugin/views/argument/Fid.php b/core/modules/file/src/Plugin/views/argument/Fid.php
index a7104fa7df72ad80ea7dc9fe1610b0f628a81028..832e85dad5741d41edf3321167e458736557e3e9 100644
--- a/core/modules/file/src/Plugin/views/argument/Fid.php
+++ b/core/modules/file/src/Plugin/views/argument/Fid.php
@@ -3,7 +3,6 @@
 namespace Drupal\file\Plugin\views\argument;
 
 use Drupal\Core\Entity\EntityManagerInterface;
-use Drupal\Core\Entity\Query\QueryFactory;
 use Drupal\views\Plugin\views\argument\NumericArgument;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -24,13 +23,6 @@ class Fid extends NumericArgument implements ContainerFactoryPluginInterface {
    */
   protected $entityManager;
 
-  /**
-   * The entity query factory service.
-   *
-   * @var \Drupal\Core\Entity\Query\QueryFactory
-   */
-  protected $entityQuery;
-
   /**
    * Constructs a Drupal\file\Plugin\views\argument\Fid object.
    *
@@ -42,13 +34,10 @@ class Fid extends NumericArgument implements ContainerFactoryPluginInterface {
    *   The plugin implementation definition.
    * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
    *   The entity manager.
-   * @param \Drupal\Core\Entity\Query\QueryFactory $entity_query
-   *   The entity query factory.
    */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager, QueryFactory $entity_query) {
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager) {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
     $this->entityManager = $entity_manager;
-    $this->entityQuery = $entity_query;
   }
 
   /**
@@ -59,8 +48,7 @@ public static function create(ContainerInterface $container, array $configuratio
       $configuration,
       $plugin_id,
       $plugin_definition,
-      $container->get('entity.manager'),
-      $container->get('entity.query')
+      $container->get('entity.manager')
     );
   }
 
@@ -68,11 +56,11 @@ public static function create(ContainerInterface $container, array $configuratio
    * Override the behavior of titleQuery(). Get the filenames.
    */
   public function titleQuery() {
-    $fids = $this->entityQuery->get('file')
+    $storage = $this->entityManager->getStorage('file');
+    $fids = $storage->getQuery()
       ->condition('fid', $this->value, 'IN')
       ->execute();
-    $controller = $this->entityManager->getStorage('file');
-    $files = $controller->loadMultiple($fids);
+    $files = $storage->loadMultiple($fids);
     $titles = array();
     foreach ($files as $file) {
       $titles[] = $file->getFilename();
diff --git a/core/modules/filter/src/FilterFormatFormBase.php b/core/modules/filter/src/FilterFormatFormBase.php
index c1924edc7f114aea304cb66f5d90f2d26015f4c0..c60171ca0bf80e1c2d820b8d1bcb97779ce70560 100644
--- a/core/modules/filter/src/FilterFormatFormBase.php
+++ b/core/modules/filter/src/FilterFormatFormBase.php
@@ -3,42 +3,14 @@
 namespace Drupal\filter;
 
 use Drupal\Core\Entity\EntityForm;
-use Drupal\Core\Entity\Query\QueryFactory;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\filter\Plugin\Filter\FilterNull;
-use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
  * Provides a base form for a filter format.
  */
 abstract class FilterFormatFormBase extends EntityForm {
 
-  /**
-   * The entity query factory.
-   *
-   * @var \Drupal\Core\Entity\Query\QueryFactory
-   */
-  protected $queryFactory;
-
-  /**
-   * Constructs a new FilterFormatFormBase.
-   *
-   * @param \Drupal\Core\Entity\Query\QueryFactory $query_factory
-   *   The entity query factory.
-   */
-  public function __construct(QueryFactory $query_factory) {
-    $this->queryFactory = $query_factory;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container) {
-    return new static(
-      $container->get('entity.query')
-    );
-  }
-
   /**
    * {@inheritdoc}
    */
@@ -189,8 +161,9 @@ public function form(array $form, FormStateInterface $form_state) {
    *   TRUE if the format exists, FALSE otherwise.
    */
   public function exists($format_id) {
-    return (bool) $this->queryFactory
-      ->get('filter_format')
+    return (bool) $this->entityTypeManager
+      ->getStorage('filter_format')
+      ->getQuery()
       ->condition('format', $format_id)
       ->execute();
   }
@@ -209,8 +182,9 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
     $form_state->setValueForElement($form['format'], $format_format);
     $form_state->setValueForElement($form['name'], $format_name);
 
-    $format_exists = $this->queryFactory
-      ->get('filter_format')
+    $format_exists = $this->entityTypeManager
+      ->getStorage('filter_format')
+      ->getQuery()
       ->condition('format', $format_format, '<>')
       ->condition('name', $format_name)
       ->execute();
diff --git a/core/modules/forum/forum.services.yml b/core/modules/forum/forum.services.yml
index 5f56f3d532c52bfdc7f02ded3ce3ad1b766e50fd..8855717186c8b85147ebe03427e37f3e2bd5d327 100644
--- a/core/modules/forum/forum.services.yml
+++ b/core/modules/forum/forum.services.yml
@@ -24,5 +24,5 @@ services:
     class: Drupal\forum\ForumUninstallValidator
     tags:
       - { name: module_install.uninstall_validator }
-    arguments: ['@entity.manager', '@entity.query', '@config.factory', '@string_translation']
+    arguments: ['@entity_type.manager', '@config.factory', '@string_translation']
     lazy: true
diff --git a/core/modules/forum/src/ForumUninstallValidator.php b/core/modules/forum/src/ForumUninstallValidator.php
index b2bb98b371ba0ab44fd1cae375c619e18df8ee21..8ee0310fe9054ba5cfede34afa6a3dadbe2b9bfa 100644
--- a/core/modules/forum/src/ForumUninstallValidator.php
+++ b/core/modules/forum/src/ForumUninstallValidator.php
@@ -3,8 +3,7 @@
 namespace Drupal\forum;
 
 use Drupal\Core\Config\ConfigFactoryInterface;
-use Drupal\Core\Entity\EntityManagerInterface;
-use Drupal\Core\Entity\Query\QueryFactory;
+use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Extension\ModuleUninstallValidatorInterface;
 use Drupal\Core\StringTranslation\StringTranslationTrait;
 use Drupal\Core\StringTranslation\TranslationInterface;
@@ -19,18 +18,11 @@ class ForumUninstallValidator implements ModuleUninstallValidatorInterface {
   use StringTranslationTrait;
 
   /**
-   * The field storage config storage.
+   * The entity type manager.
    *
-   * @var \Drupal\Core\Config\Entity\ConfigEntityStorageInterface
+   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
    */
-  protected $vocabularyStorage;
-
-  /**
-   * The entity query factory.
-   *
-   * @var \Drupal\Core\Entity\Query\QueryFactory
-   */
-  protected $queryFactory;
+  protected $entityTypeManager;
 
   /**
    * The config factory.
@@ -42,18 +34,15 @@ class ForumUninstallValidator implements ModuleUninstallValidatorInterface {
   /**
    * Constructs a new ForumUninstallValidator.
    *
-   * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
-   *   The entity manager.
-   * @param \Drupal\Core\Entity\Query\QueryFactory $query_factory
-   *   The entity query factory.
+   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
+   *   The entity type manager.
    * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
    *   The config factory.
    * @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
    *   The string translation service.
    */
-  public function __construct(EntityManagerInterface $entity_manager, QueryFactory $query_factory, ConfigFactoryInterface $config_factory, TranslationInterface $string_translation) {
-    $this->vocabularyStorage = $entity_manager->getStorage('taxonomy_vocabulary');
-    $this->queryFactory = $query_factory;
+  public function __construct(EntityTypeManagerInterface $entity_type_manager, ConfigFactoryInterface $config_factory, TranslationInterface $string_translation) {
+    $this->entityTypeManager = $entity_type_manager;
     $this->configFactory = $config_factory;
     $this->stringTranslation = $string_translation;
   }
@@ -94,7 +83,7 @@ public function validate($module) {
    *   TRUE if there are forum nodes, FALSE otherwise.
    */
   protected function hasForumNodes() {
-    $nodes = $this->queryFactory->get('node')
+    $nodes = $this->entityTypeManager->getStorage('node')->getQuery()
       ->condition('type', 'forum')
       ->accessCheck(FALSE)
       ->range(0, 1)
@@ -112,7 +101,7 @@ protected function hasForumNodes() {
    *   TRUE if there are terms for this vocabulary, FALSE otherwise.
    */
   protected function hasTermsForVocabulary(VocabularyInterface $vocabulary) {
-    $terms = $this->queryFactory->get('taxonomy_term')
+    $terms = $this->entityTypeManager->getStorage('taxonomy_term')->getQuery()
       ->condition('vid', $vocabulary->id())
       ->accessCheck(FALSE)
       ->range(0, 1)
@@ -128,7 +117,7 @@ protected function hasTermsForVocabulary(VocabularyInterface $vocabulary) {
    */
   protected function getForumVocabulary() {
     $vid = $this->configFactory->get('forum.settings')->get('vocabulary');
-    return $this->vocabularyStorage->load($vid);
+    return $this->entityTypeManager->getStorage('taxonomy_vocabulary')->load($vid);
   }
 
 }
diff --git a/core/modules/menu_link_content/src/Plugin/Deriver/MenuLinkContentDeriver.php b/core/modules/menu_link_content/src/Plugin/Deriver/MenuLinkContentDeriver.php
index e05fa2158fd5a1c8621d409d443aa904769fadb0..c53f1327cb955d405a09e0cdde8ed917737dc10c 100644
--- a/core/modules/menu_link_content/src/Plugin/Deriver/MenuLinkContentDeriver.php
+++ b/core/modules/menu_link_content/src/Plugin/Deriver/MenuLinkContentDeriver.php
@@ -4,7 +4,6 @@
 
 use Drupal\Component\Plugin\Derivative\DeriverBase;
 use Drupal\Core\Entity\EntityManagerInterface;
-use Drupal\Core\Entity\Query\QueryFactory;
 use Drupal\Core\Menu\MenuLinkManagerInterface;
 use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -17,13 +16,6 @@
  */
 class MenuLinkContentDeriver extends DeriverBase implements ContainerDeriverInterface {
 
-  /**
-   * The query factory.
-   *
-   * @var \Drupal\Core\Entity\Query\QueryFactory
-   */
-  protected $queryFactory;
-
   /**
    * The entity manager.
    *
@@ -41,15 +33,12 @@ class MenuLinkContentDeriver extends DeriverBase implements ContainerDeriverInte
   /**
    * Constructs a MenuLinkContentDeriver instance.
    *
-   * @param \Drupal\Core\Entity\Query\QueryFactory $query_factory
-   *   The query factory.
    * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
    *   The entity manager.
    * @param \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager
    *   The menu link manager.
    */
-  public function __construct(QueryFactory $query_factory, EntityManagerInterface $entity_manager, MenuLinkManagerInterface $menu_link_manager) {
-    $this->queryFactory = $query_factory;
+  public function __construct(EntityManagerInterface $entity_manager, MenuLinkManagerInterface $menu_link_manager) {
     $this->entityManager = $entity_manager;
     $this->menuLinkManager = $menu_link_manager;
   }
@@ -59,7 +48,6 @@ public function __construct(QueryFactory $query_factory, EntityManagerInterface
    */
   public static function create(ContainerInterface $container, $base_plugin_id) {
     return new static(
-      $container->get('entity.query'),
       $container->get('entity.manager'),
       $container->get('plugin.manager.menu.link')
     );
@@ -70,7 +58,7 @@ public static function create(ContainerInterface $container, $base_plugin_id) {
    */
   public function getDerivativeDefinitions($base_plugin_definition) {
     // Get all custom menu links which should be rediscovered.
-    $entity_ids = $this->queryFactory->get('menu_link_content')
+    $entity_ids = $this->entityManager->getStorage('menu_link_content')->getQuery()
       ->condition('rediscover', TRUE)
       ->execute();
     $plugin_definitions = [];
diff --git a/core/modules/menu_ui/src/MenuForm.php b/core/modules/menu_ui/src/MenuForm.php
index 7e09fbf65791ef0d8d9123a5413f76b223925a2e..105875f727aa214185662a570e1d42c1475ce78d 100644
--- a/core/modules/menu_ui/src/MenuForm.php
+++ b/core/modules/menu_ui/src/MenuForm.php
@@ -5,7 +5,6 @@
 use Drupal\Component\Utility\NestedArray;
 use Drupal\Core\Cache\CacheableMetadata;
 use Drupal\Core\Entity\EntityForm;
-use Drupal\Core\Entity\Query\QueryFactory;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\Core\Link;
@@ -23,13 +22,6 @@
  */
 class MenuForm extends EntityForm {
 
-  /**
-   * The factory for entity queries.
-   *
-   * @var \Drupal\Core\Entity\Query\QueryFactory
-   */
-  protected $entityQueryFactory;
-
   /**
    * The menu link manager.
    *
@@ -61,8 +53,6 @@ class MenuForm extends EntityForm {
   /**
    * Constructs a MenuForm object.
    *
-   * @param \Drupal\Core\Entity\Query\QueryFactory $entity_query_factory
-   *   The factory for entity queries.
    * @param \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager
    *   The menu link manager.
    * @param \Drupal\Core\Menu\MenuLinkTreeInterface $menu_tree
@@ -70,8 +60,7 @@ class MenuForm extends EntityForm {
    * @param \Drupal\Core\Utility\LinkGeneratorInterface $link_generator
    *   The link generator.
    */
-  public function __construct(QueryFactory $entity_query_factory, MenuLinkManagerInterface $menu_link_manager, MenuLinkTreeInterface $menu_tree, LinkGeneratorInterface $link_generator) {
-    $this->entityQueryFactory = $entity_query_factory;
+  public function __construct(MenuLinkManagerInterface $menu_link_manager, MenuLinkTreeInterface $menu_tree, LinkGeneratorInterface $link_generator) {
     $this->menuLinkManager = $menu_link_manager;
     $this->menuTree = $menu_tree;
     $this->linkGenerator = $link_generator;
@@ -82,7 +71,6 @@ public function __construct(QueryFactory $entity_query_factory, MenuLinkManagerI
    */
   public static function create(ContainerInterface $container) {
     return new static(
-      $container->get('entity.query'),
       $container->get('plugin.manager.menu.link'),
       $container->get('menu.link_tree'),
       $container->get('link_generator')
@@ -160,7 +148,7 @@ public function form(array $form, FormStateInterface $form_state) {
    */
   public function menuNameExists($value) {
     // Check first to see if a menu with this ID exists.
-    if ($this->entityQueryFactory->get('menu')->condition('id', $value)->range(0, 1)->count()->execute()) {
+    if ($this->entityTypeManager->getStorage('menu')->getQuery()->condition('id', $value)->range(0, 1)->count()->execute()) {
       return TRUE;
     }
 
diff --git a/core/modules/migrate/src/Plugin/migrate/process/DedupeEntity.php b/core/modules/migrate/src/Plugin/migrate/process/DedupeEntity.php
index a616c86c393922122d9ed9f27540d231921f573c..31c3eca475c4e776a296211ecc2411f0c6ac2755 100644
--- a/core/modules/migrate/src/Plugin/migrate/process/DedupeEntity.php
+++ b/core/modules/migrate/src/Plugin/migrate/process/DedupeEntity.php
@@ -2,7 +2,7 @@
 
 namespace Drupal\migrate\Plugin\migrate\process;
 
-use Drupal\Core\Entity\Query\QueryFactory;
+use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\migrate\Plugin\MigrationInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -22,11 +22,11 @@
 class DedupeEntity extends DedupeBase implements ContainerFactoryPluginInterface {
 
   /**
-   * The entity query factory.
+   * The entity storage.
    *
-   * @var \Drupal\Core\Entity\Query\QueryFactoryInterface
+   * @var \Drupal\Core\Entity\EntityStorageInterface
    */
-  protected $entityQueryFactory;
+  protected $entityStorage;
 
   /**
    * The current migration.
@@ -38,10 +38,10 @@ class DedupeEntity extends DedupeBase implements ContainerFactoryPluginInterface
   /**
    * {@inheritdoc}
    */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, QueryFactory $entity_query_factory) {
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityTypeManagerInterface $entity_type_manager) {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
     $this->migration = $migration;
-    $this->entityQueryFactory = $entity_query_factory;
+    $this->entityStorage = $entity_type_manager->getStorage($this->configuration['entity_type']);
   }
 
   /**
@@ -53,7 +53,7 @@ public static function create(ContainerInterface $container, array $configuratio
       $plugin_id,
       $plugin_definition,
       $migration,
-      $container->get('entity.query')
+      $container->get('entity_type.manager')
     );
   }
 
@@ -63,8 +63,7 @@ public static function create(ContainerInterface $container, array $configuratio
   protected function exists($value) {
     // Plugins are cached so for every run we need a new query object.
     $query = $this
-      ->entityQueryFactory
-      ->get($this->configuration['entity_type'], 'AND')
+      ->entityStorage->getQuery()
       ->condition($this->configuration['field'], $value);
     if (!empty($this->configuration['migrated'])) {
       // Check if each entity is in the ID map.
diff --git a/core/modules/migrate/tests/src/Unit/process/DedupeEntityTest.php b/core/modules/migrate/tests/src/Unit/process/DedupeEntityTest.php
index 4fe8db3bc7f62e3b7b7891b324e41a3ec1dc6d68..2aec300f3693e31e3f18d1be641d63e23e36d0c7 100644
--- a/core/modules/migrate/tests/src/Unit/process/DedupeEntityTest.php
+++ b/core/modules/migrate/tests/src/Unit/process/DedupeEntityTest.php
@@ -2,6 +2,8 @@
 
 namespace Drupal\Tests\migrate\Unit\process;
 
+use Drupal\Core\Entity\EntityStorageInterface;
+use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Entity\Query\QueryInterface;
 use Drupal\migrate\Plugin\migrate\process\DedupeEntity;
 use Drupal\Component\Utility\Unicode;
@@ -21,11 +23,11 @@ class DedupeEntityTest extends MigrateProcessTestCase {
   protected $entityQuery;
 
   /**
-   * The mock entity query factory.
+   * The mocked entity type manager.
    *
-   * @var \Drupal\Core\Entity\Query\QueryFactory|\PHPUnit_Framework_MockObject_MockObject
+   * @var \Drupal\Core\Entity\EntityTypeManagerInterface|\PHPUnit_Framework_MockObject_MockObject
    */
-  protected $entityQueryFactory;
+  protected $entityTypeManager;
 
   /**
    * The migration configuration, initialized to set the ID to test.
@@ -43,12 +45,16 @@ protected function setUp() {
     $this->entityQuery = $this->getMockBuilder('Drupal\Core\Entity\Query\QueryInterface')
       ->disableOriginalConstructor()
       ->getMock();
-    $this->entityQueryFactory = $this->getMockBuilder('Drupal\Core\Entity\Query\QueryFactory')
-      ->disableOriginalConstructor()
-      ->getMock();
-    $this->entityQueryFactory->expects($this->any())
-      ->method('get')
-      ->will($this->returnValue($this->entityQuery));
+    $this->entityTypeManager = $this->getMock(EntityTypeManagerInterface::class);
+
+    $storage = $this->getMock(EntityStorageInterface::class);
+    $storage->expects($this->any())
+      ->method('getQuery')
+      ->willReturn($this->entityQuery);
+    $this->entityTypeManager->expects($this->any())
+      ->method('getStorage')
+      ->with('test_entity_type')
+      ->willReturn($storage);
     parent::setUp();
   }
 
@@ -67,7 +73,7 @@ public function testDedupe($count, $postfix = '', $start = NULL, $length = NULL)
     }
     $configuration['start'] = isset($start) ? $start : NULL;
     $configuration['length'] = isset($length) ? $length : NULL;
-    $plugin = new DedupeEntity($configuration, 'dedupe_entity', array(), $this->getMigration(), $this->entityQueryFactory);
+    $plugin = new DedupeEntity($configuration, 'dedupe_entity', array(), $this->getMigration(), $this->entityTypeManager);
     $this->entityQueryExpects($count);
     $value = $this->randomMachineName(32);
     $actual = $plugin->transform($value, $this->migrateExecutable, $this->row, 'testproperty');
@@ -85,7 +91,7 @@ public function testDedupeEntityInvalidStart() {
       'field' => 'test_field',
       'start' => 'foobar',
     );
-    $plugin = new DedupeEntity($configuration, 'dedupe_entity', array(), $this->getMigration(), $this->entityQueryFactory);
+    $plugin = new DedupeEntity($configuration, 'dedupe_entity', array(), $this->getMigration(), $this->entityTypeManager);
     $this->setExpectedException('Drupal\migrate\MigrateException', 'The start position configuration key should be an integer. Omit this key to capture from the beginning of the string.');
     $plugin->transform('test_start', $this->migrateExecutable, $this->row, 'testproperty');
   }
@@ -99,7 +105,7 @@ public function testDedupeEntityInvalidLength() {
       'field' => 'test_field',
       'length' => 'foobar',
     );
-    $plugin = new DedupeEntity($configuration, 'dedupe_entity', array(), $this->getMigration(), $this->entityQueryFactory);
+    $plugin = new DedupeEntity($configuration, 'dedupe_entity', array(), $this->getMigration(), $this->entityTypeManager);
     $this->setExpectedException('Drupal\migrate\MigrateException', 'The character length configuration key should be an integer. Omit this key to capture the entire string.');
     $plugin->transform('test_length', $this->migrateExecutable, $this->row, 'testproperty');
   }
@@ -171,7 +177,7 @@ public function testDedupeMigrated() {
       'field' => 'test_field',
       'migrated' => TRUE,
     );
-    $plugin = new DedupeEntity($configuration, 'dedupe_entity', array(), $this->getMigration(), $this->entityQueryFactory);
+    $plugin = new DedupeEntity($configuration, 'dedupe_entity', array(), $this->getMigration(), $this->entityTypeManager);
 
     // Setup the entityQuery used in DedupeEntity::exists. The map, $map, is
     // an array consisting of the four input parameters to the query condition
diff --git a/core/modules/node/src/Form/NodeTypeDeleteConfirm.php b/core/modules/node/src/Form/NodeTypeDeleteConfirm.php
index ada9fd558546a12a4fe52f7faefe10439983c532..50abec1ad96664b98a263cf213889578749d0d2c 100644
--- a/core/modules/node/src/Form/NodeTypeDeleteConfirm.php
+++ b/core/modules/node/src/Form/NodeTypeDeleteConfirm.php
@@ -2,47 +2,19 @@
 
 namespace Drupal\node\Form;
 
-use Drupal\Core\Entity\Query\QueryFactory;
 use Drupal\Core\Entity\EntityDeleteForm;
 use Drupal\Core\Form\FormStateInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
  * Provides a form for content type deletion.
  */
 class NodeTypeDeleteConfirm extends EntityDeleteForm {
 
-  /**
-   * The query factory to create entity queries.
-   *
-   * @var \Drupal\Core\Entity\Query\QueryFactory
-   */
-  protected $queryFactory;
-
-  /**
-   * Constructs a new NodeTypeDeleteConfirm object.
-   *
-   * @param \Drupal\Core\Entity\Query\QueryFactory $query_factory
-   *   The entity query object.
-   */
-  public function __construct(QueryFactory $query_factory) {
-    $this->queryFactory = $query_factory;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container) {
-    return new static(
-      $container->get('entity.query')
-    );
-  }
-
   /**
    * {@inheritdoc}
    */
   public function buildForm(array $form, FormStateInterface $form_state) {
-    $num_nodes = $this->queryFactory->get('node')
+    $num_nodes = $this->entityTypeManager->getStorage('node')->getQuery()
       ->condition('type', $this->entity->id())
       ->count()
       ->execute();
diff --git a/core/modules/node/tests/node_access_test_auto_bubbling/src/Controller/NodeAccessTestAutoBubblingController.php b/core/modules/node/tests/node_access_test_auto_bubbling/src/Controller/NodeAccessTestAutoBubblingController.php
index 4bc05c49b4af81088b04319414dad9feb0497e27..46f4a5e1026fbee32d8c871a56d27a9350a6c2a7 100644
--- a/core/modules/node/tests/node_access_test_auto_bubbling/src/Controller/NodeAccessTestAutoBubblingController.php
+++ b/core/modules/node/tests/node_access_test_auto_bubbling/src/Controller/NodeAccessTestAutoBubblingController.php
@@ -4,41 +4,13 @@
 
 use Drupal\Core\Controller\ControllerBase;
 use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
-use Drupal\Core\Entity\Query\QueryFactory;
 use Drupal\node\NodeInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
  * Returns a node ID listing.
  */
 class NodeAccessTestAutoBubblingController extends ControllerBase implements ContainerInjectionInterface {
 
-  /**
-   * The entity query factory service.
-   *
-   * @var \Drupal\Core\Entity\Query\QueryFactory
-   */
-  protected $entityQuery;
-
-  /**
-   * Constructs a new NodeAccessTestAutoBubblingController.
-   *
-   * @param \Drupal\Core\Entity\Query\QueryFactory $entity_query
-   *   The entity query factory.
-   */
-  public function __construct(QueryFactory $entity_query) {
-    $this->entityQuery = $entity_query;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container) {
-    return new static(
-      $container->get('entity.query')
-    );
-  }
-
   /**
    * Lists the three latest published node IDs.
    *
@@ -46,7 +18,7 @@ public static function create(ContainerInterface $container) {
    *   A render array.
    */
   public function latest() {
-    $nids = $this->entityQuery->get('node')
+    $nids = $this->entityTypeManager()->getStorage('node')->getQuery()
       ->condition('status', NodeInterface::PUBLISHED)
       ->sort('created', 'DESC')
       ->range(0, 3)
diff --git a/core/modules/search/src/Form/SearchPageFormBase.php b/core/modules/search/src/Form/SearchPageFormBase.php
index 92b4fbe03f6700271eddd06665c3e2f2ee2a3521..bc7032f428a14ae01b8bf91c916d107384a1c29e 100644
--- a/core/modules/search/src/Form/SearchPageFormBase.php
+++ b/core/modules/search/src/Form/SearchPageFormBase.php
@@ -3,7 +3,6 @@
 namespace Drupal\search\Form;
 
 use Drupal\Core\Entity\EntityForm;
-use Drupal\Core\Entity\Query\QueryFactory;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Plugin\PluginFormInterface;
 use Drupal\search\SearchPageRepositoryInterface;
@@ -28,13 +27,6 @@ abstract class SearchPageFormBase extends EntityForm {
    */
   protected $plugin;
 
-  /**
-   * The entity query factory.
-   *
-   * @var \Drupal\Core\Entity\Query\QueryFactory
-   */
-  protected $entityQuery;
-
   /**
    * The search page repository.
    *
@@ -45,13 +37,10 @@ abstract class SearchPageFormBase extends EntityForm {
   /**
    * Constructs a new search form.
    *
-   * @param \Drupal\Core\Entity\Query\QueryFactory $entity_query
-   *   The entity query.
    * @param \Drupal\search\SearchPageRepositoryInterface $search_page_repository
    *   The search page repository.
    */
-  public function __construct(QueryFactory $entity_query, SearchPageRepositoryInterface $search_page_repository) {
-    $this->entityQuery = $entity_query;
+  public function __construct(SearchPageRepositoryInterface $search_page_repository) {
     $this->searchPageRepository = $search_page_repository;
   }
 
@@ -60,7 +49,6 @@ public function __construct(QueryFactory $entity_query, SearchPageRepositoryInte
    */
   public static function create(ContainerInterface $container) {
     return new static(
-      $container->get('entity.query'),
       $container->get('search.search_page_repository')
     );
   }
@@ -131,7 +119,7 @@ public function form(array $form, FormStateInterface $form_state) {
    *   TRUE if the search configuration exists, FALSE otherwise.
    */
   public function exists($id) {
-    $entity = $this->entityQuery->get('search_page')
+    $entity = $this->entityTypeManager->getStorage('search_page')->getQuery()
       ->condition('id', $id)
       ->execute();
     return (bool) $entity;
@@ -144,7 +132,7 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
     parent::validateForm($form, $form_state);
 
     // Ensure each path is unique.
-    $path = $this->entityQuery->get('search_page')
+    $path = $this->entityTypeManager->getStorage('search_page')->getQuery()
       ->condition('path', $form_state->getValue('path'))
       ->condition('id', $form_state->getValue('id'), '<>')
       ->execute();
diff --git a/core/modules/system/src/Controller/SystemController.php b/core/modules/system/src/Controller/SystemController.php
index 41ed82469244b95bb5609814a9d744200fcacdb5..f25e83221714a793d2081e5ff68e54ca427c2529 100644
--- a/core/modules/system/src/Controller/SystemController.php
+++ b/core/modules/system/src/Controller/SystemController.php
@@ -4,7 +4,6 @@
 
 use Drupal\Core\Cache\CacheableMetadata;
 use Drupal\Core\Controller\ControllerBase;
-use Drupal\Core\Entity\Query\QueryFactory;
 use Drupal\Core\Extension\ThemeHandlerInterface;
 use Drupal\Core\Form\FormBuilderInterface;
 use Drupal\Core\Menu\MenuLinkTreeInterface;
@@ -19,13 +18,6 @@
  */
 class SystemController extends ControllerBase {
 
-  /**
-   * The entity query factory object.
-   *
-   * @var \Drupal\Core\Entity\Query\QueryFactory
-   */
-  protected $queryFactory;
-
   /**
    * System Manager Service.
    *
@@ -66,8 +58,6 @@ class SystemController extends ControllerBase {
    *
    * @param \Drupal\system\SystemManager $systemManager
    *   System manager service.
-   * @param \Drupal\Core\Entity\Query\QueryFactory $queryFactory
-   *   The entity query object.
    * @param \Drupal\Core\Theme\ThemeAccessCheck $theme_access
    *   The theme access checker service.
    * @param \Drupal\Core\Form\FormBuilderInterface $form_builder
@@ -77,9 +67,8 @@ class SystemController extends ControllerBase {
    * @param \Drupal\Core\Menu\MenuLinkTreeInterface $menu_link_tree
    *   The menu link tree service.
    */
-  public function __construct(SystemManager $systemManager, QueryFactory $queryFactory, ThemeAccessCheck $theme_access, FormBuilderInterface $form_builder, ThemeHandlerInterface $theme_handler, MenuLinkTreeInterface $menu_link_tree) {
+  public function __construct(SystemManager $systemManager, ThemeAccessCheck $theme_access, FormBuilderInterface $form_builder, ThemeHandlerInterface $theme_handler, MenuLinkTreeInterface $menu_link_tree) {
     $this->systemManager = $systemManager;
-    $this->queryFactory = $queryFactory;
     $this->themeAccess = $theme_access;
     $this->formBuilder = $form_builder;
     $this->themeHandler = $theme_handler;
@@ -92,7 +81,6 @@ public function __construct(SystemManager $systemManager, QueryFactory $queryFac
   public static function create(ContainerInterface $container) {
     return new static(
       $container->get('system.manager'),
-      $container->get('entity.query'),
       $container->get('access_check.theme'),
       $container->get('form_builder'),
       $container->get('theme_handler'),
diff --git a/core/modules/system/tests/modules/entity_test/src/Controller/EntityTestController.php b/core/modules/system/tests/modules/entity_test/src/Controller/EntityTestController.php
index a753eabdedc0ff8276ac4fb3159d5f23b3799f8b..d0cd895bf998b65377d8b6616cb14e794d36d208 100644
--- a/core/modules/system/tests/modules/entity_test/src/Controller/EntityTestController.php
+++ b/core/modules/system/tests/modules/entity_test/src/Controller/EntityTestController.php
@@ -4,40 +4,12 @@
 
 use Drupal\Core\Cache\Cache;
 use Drupal\Core\Controller\ControllerBase;
-use Drupal\Core\Entity\Query\QueryFactory;
-use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
  * Controller routines for entity_test routes.
  */
 class EntityTestController extends ControllerBase {
 
-  /**
-   * The entity query factory.
-   *
-   * @var \Drupal\Core\Entity\Query\QueryFactory
-   */
-  protected $entityQueryFactory;
-
-  /**
-   * Constructs a new EntityTestController.
-   *
-   * @param \Drupal\Core\Entity\Query\QueryFactory $entity_query_factory
-   *   The entity query factory.
-   */
-  public function __construct(QueryFactory $entity_query_factory) {
-    $this->entityQueryFactory = $entity_query_factory;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container) {
-    return new static(
-      $container->get('entity.query')
-    );
-  }
-
   /**
    * Returns an empty page.
    *
@@ -69,8 +41,7 @@ public function listReferencingEntities($entity_reference_field_name, $reference
       return array();
     }
 
-    $query = $this->entityQueryFactory
-      ->get('entity_test')
+    $query = $this->entityTypeManager()->getStorage('entity_test')->getQuery()
       ->condition($entity_reference_field_name . '.target_id', $referenced_entity_id);
     $entities = $this->entityManager()
       ->getStorage('entity_test')
@@ -91,7 +62,7 @@ public function listReferencingEntities($entity_reference_field_name, $reference
    */
   public function listEntitiesAlphabetically($entity_type_id) {
     $entity_type_definition = $this->entityManager()->getDefinition($entity_type_id);
-    $query = $this->entityQueryFactory->get($entity_type_id);
+    $query = $this->entityTypeManager()->getStorage($entity_type_id)->getQuery();
 
     // Sort by label field, if any.
     if ($label_field = $entity_type_definition->getKey('label')) {
diff --git a/core/modules/user/src/AccountForm.php b/core/modules/user/src/AccountForm.php
index 05257fd684a5ed152ecc7ac62bcbc3923ed44956..5f4d82002e1b71dab3ad912b83d7cda7b710ab6f 100644
--- a/core/modules/user/src/AccountForm.php
+++ b/core/modules/user/src/AccountForm.php
@@ -8,7 +8,6 @@
 use Drupal\Core\Entity\EntityConstraintViolationListInterface;
 use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
-use Drupal\Core\Entity\Query\QueryFactory;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\Core\Language\LanguageManagerInterface;
@@ -29,13 +28,6 @@ abstract class AccountForm extends ContentEntityForm {
    */
   protected $languageManager;
 
-  /**
-   * The entity query factory service.
-   *
-   * @var \Drupal\Core\Entity\Query\QueryFactory
-   */
-  protected $entityQuery;
-
   /**
    * Constructs a new EntityForm object.
    *
@@ -43,17 +35,14 @@ abstract class AccountForm extends ContentEntityForm {
    *   The entity manager.
    * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
    *   The language manager.
-   * @param \Drupal\Core\Entity\Query\QueryFactory $entity_query
-   *   The entity query factory.
    * @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info
    *   The entity type bundle service.
    * @param \Drupal\Component\Datetime\TimeInterface $time
    *   The time service.
    */
-  public function __construct(EntityManagerInterface $entity_manager, LanguageManagerInterface $language_manager, QueryFactory $entity_query, EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, TimeInterface $time = NULL) {
+  public function __construct(EntityManagerInterface $entity_manager, LanguageManagerInterface $language_manager, EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, TimeInterface $time = NULL) {
     parent::__construct($entity_manager, $entity_type_bundle_info, $time);
     $this->languageManager = $language_manager;
-    $this->entityQuery = $entity_query;
   }
 
   /**
@@ -63,7 +52,6 @@ public static function create(ContainerInterface $container) {
     return new static(
       $container->get('entity.manager'),
       $container->get('language_manager'),
-      $container->get('entity.query'),
       $container->get('entity_type.bundle.info'),
       $container->get('datetime.time')
     );
diff --git a/core/modules/user/src/UserListBuilder.php b/core/modules/user/src/UserListBuilder.php
index 1692f5a5bb97a9a102b53d8f4d3e76c1021c51d0..9dae5f4a23eb26be5775751e2239e4ff358519b6 100644
--- a/core/modules/user/src/UserListBuilder.php
+++ b/core/modules/user/src/UserListBuilder.php
@@ -8,7 +8,6 @@
 use Drupal\Core\Entity\EntityListBuilder;
 use Drupal\Core\Entity\EntityStorageInterface;
 use Drupal\Core\Entity\EntityTypeInterface;
-use Drupal\Core\Entity\Query\QueryFactory;
 use Drupal\Core\Routing\RedirectDestinationInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
@@ -19,13 +18,6 @@
  */
 class UserListBuilder extends EntityListBuilder {
 
-  /**
-   * The entity query factory.
-   *
-   * @var \Drupal\Core\Entity\Query\QueryFactory
-   */
-  protected $queryFactory;
-
   /**
    * The date formatter service.
    *
@@ -47,16 +39,13 @@ class UserListBuilder extends EntityListBuilder {
    *   The entity type definition.
    * @param \Drupal\Core\Entity\EntityStorageInterface $storage
    *   The entity storage class.
-   * @param \Drupal\Core\Entity\Query\QueryFactory $query_factory
-   *   The entity query factory.
    * @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter
    *   The date formatter service.
    * @param \Drupal\Core\Routing\RedirectDestinationInterface $redirect_destination
    *   The redirect destination service.
    */
-  public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, QueryFactory $query_factory, DateFormatterInterface $date_formatter, RedirectDestinationInterface $redirect_destination) {
+  public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, DateFormatterInterface $date_formatter, RedirectDestinationInterface $redirect_destination) {
     parent::__construct($entity_type, $storage);
-    $this->queryFactory = $query_factory;
     $this->dateFormatter = $date_formatter;
     $this->redirectDestination = $redirect_destination;
   }
@@ -68,7 +57,6 @@ public static function createInstance(ContainerInterface $container, EntityTypeI
     return new static(
       $entity_type,
       $container->get('entity.manager')->getStorage($entity_type->id()),
-      $container->get('entity.query'),
       $container->get('date.formatter'),
       $container->get('redirect.destination')
     );
@@ -78,7 +66,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI
    * {@inheritdoc}
    */
   public function load() {
-    $entity_query = $this->queryFactory->get('user');
+    $entity_query = $this->storage->getQuery();
     $entity_query->condition('uid', 0, '<>');
     $entity_query->pager(50);
     $header = $this->buildHeader();
diff --git a/core/modules/views/src/Views.php b/core/modules/views/src/Views.php
index a82a670a1f95311219e4939e9212a6d504a6e1d5..5628d96a39b1679ca547fab89aa9e3309c5c4014 100644
--- a/core/modules/views/src/Views.php
+++ b/core/modules/views/src/Views.php
@@ -213,13 +213,13 @@ public static function getApplicableViews($type) {
       }
     }
 
-    $entity_ids = \Drupal::service('entity.query')->get('view')
+    $entity_ids = \Drupal::entityQuery('view')
       ->condition('status', TRUE)
       ->condition("display.*.display_plugin", $plugin_ids, 'IN')
       ->execute();
 
     $result = array();
-    foreach (\Drupal::entityManager()->getStorage('view')->loadMultiple($entity_ids) as $view) {
+    foreach (\Drupal::entityTypeManager()->getStorage('view')->loadMultiple($entity_ids) as $view) {
       // Check each display to see if it meets the criteria and is enabled.
 
       foreach ($view->get('display') as $id => $display) {
diff --git a/core/modules/views/tests/src/Unit/ViewsTest.php b/core/modules/views/tests/src/Unit/ViewsTest.php
index 4924154c8ff504a70b2dcfd341681cc875ababe5..00476c50d1e1c6200d75507dd1822e6550285e79 100644
--- a/core/modules/views/tests/src/Unit/ViewsTest.php
+++ b/core/modules/views/tests/src/Unit/ViewsTest.php
@@ -2,7 +2,7 @@
 
 namespace Drupal\Tests\views\Unit;
 
-use Drupal\Core\Entity\Query\QueryFactory;
+use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Tests\UnitTestCase;
 use Drupal\views\Views;
 use Drupal\views\Entity\View;
@@ -154,12 +154,12 @@ public function testGetApplicableViews($applicable_type, $expected) {
       ->with(['test_view_1', 'test_view_2', 'test_view_3'])
       ->will($this->returnValue(['test_view_1' => $view_1, 'test_view_2' => $view_2, 'test_view_3' => $view_3]));
 
-    $entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
-    $entity_manager->expects($this->exactly(2))
+    $entity_type_manager = $this->getMock(EntityTypeManagerInterface::class);
+    $entity_type_manager->expects($this->exactly(2))
       ->method('getStorage')
       ->with('view')
       ->will($this->returnValue($view_storage));
-    $this->container->set('entity.manager', $entity_manager);
+    $this->container->set('entity_type.manager', $entity_type_manager);
 
     $definitions = [
       'type_a' => [
@@ -178,9 +178,6 @@ public function testGetApplicableViews($applicable_type, $expected) {
       ->willReturn($definitions);
     $this->container->set('plugin.manager.views.display', $display_manager);
 
-    $entity_query = new QueryFactory($entity_manager);
-    $this->container->set('entity.query', $entity_query);
-
     $result = Views::getApplicableViews($applicable_type);
     $this->assertEquals($expected, $result);
   }
diff --git a/core/tests/Drupal/Tests/Core/DrupalTest.php b/core/tests/Drupal/Tests/Core/DrupalTest.php
index de94bf856323d985c4c49c1ce86e9e0f011d699c..312e60799f5062009f4493cee0983150debcdbe3 100644
--- a/core/tests/Drupal/Tests/Core/DrupalTest.php
+++ b/core/tests/Drupal/Tests/Core/DrupalTest.php
@@ -2,6 +2,10 @@
 
 namespace Drupal\Tests\Core;
 
+use Drupal\Core\Entity\EntityStorageInterface;
+use Drupal\Core\Entity\EntityTypeManagerInterface;
+use Drupal\Core\Entity\Query\QueryAggregateInterface;
+use Drupal\Core\Entity\Query\QueryInterface;
 use Drupal\Tests\UnitTestCase;
 use Drupal\Core\Url;
 use Symfony\Component\HttpFoundation\RequestStack;
@@ -240,16 +244,24 @@ public function testHttpClient() {
    * @covers ::entityQuery
    */
   public function testEntityQuery() {
-    $query = $this->getMockBuilder('Drupal\Core\Entity\Query\QueryFactory')
-      ->disableOriginalConstructor()
-      ->getMock();
-    $query->expects($this->once())
-      ->method('get')
-      ->with('test_entity', 'OR')
-      ->will($this->returnValue(TRUE));
-    $this->setMockContainerService('entity.query', $query);
+    $query = $this->getMock(QueryInterface::class);
+    $storage = $this->getMock(EntityStorageInterface::class);
+    $storage
+      ->expects($this->once())
+      ->method('getQuery')
+      ->with('OR')
+      ->willReturn($query);
+
+    $entity_type_manager = $this->getMock(EntityTypeManagerInterface::class);
+    $entity_type_manager
+      ->expects($this->once())
+      ->method('getStorage')
+      ->with('test_entity')
+      ->willReturn($storage);
 
-    $this->assertNotNull(\Drupal::entityQuery('test_entity', 'OR'));
+    $this->setMockContainerService('entity_type.manager', $entity_type_manager);
+
+    $this->assertInstanceOf(QueryInterface::class, \Drupal::entityQuery('test_entity', 'OR'));
   }
 
   /**
@@ -258,16 +270,24 @@ public function testEntityQuery() {
    * @covers ::entityQueryAggregate
    */
   public function testEntityQueryAggregate() {
-    $query = $this->getMockBuilder('Drupal\Core\Entity\Query\QueryFactory')
-      ->disableOriginalConstructor()
-      ->getMock();
-    $query->expects($this->once())
-      ->method('getAggregate')
-      ->with('test_entity', 'OR')
-      ->will($this->returnValue(TRUE));
-    $this->setMockContainerService('entity.query', $query);
-
-    $this->assertNotNull(\Drupal::entityQueryAggregate('test_entity', 'OR'));
+    $query = $this->getMock(QueryAggregateInterface::class);
+    $storage = $this->getMock(EntityStorageInterface::class);
+    $storage
+      ->expects($this->once())
+      ->method('getAggregateQuery')
+      ->with('OR')
+      ->willReturn($query);
+
+    $entity_type_manager = $this->getMock(EntityTypeManagerInterface::class);
+    $entity_type_manager
+      ->expects($this->once())
+      ->method('getStorage')
+      ->with('test_entity')
+      ->willReturn($storage);
+
+    $this->setMockContainerService('entity_type.manager', $entity_type_manager);
+
+    $this->assertInstanceOf(QueryAggregateInterface::class, \Drupal::entityQueryAggregate('test_entity', 'OR'));
   }
 
   /**
diff --git a/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php
index 56b4b007e90dcd224b9be1fad6117effd8fd9151..5d56929fb60d867b70897478b61a7cdc3f642a56 100644
--- a/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php
@@ -10,6 +10,7 @@
 use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Entity\EntityStorageInterface;
+use Drupal\Core\Entity\Query\QueryFactoryInterface;
 use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
 use Drupal\Core\Language\Language;
 use Drupal\Tests\UnitTestCase;
@@ -1245,9 +1246,7 @@ public function testHasData() {
       ->method('execute')
       ->willReturn(array(5));
 
-    $factory = $this->getMockBuilder('Drupal\Core\Entity\Query\QueryFactory')
-      ->disableOriginalConstructor()
-      ->getMock();
+    $factory = $this->getMock(QueryFactoryInterface::class);
     $factory->expects($this->once())
       ->method('get')
       ->with($this->entityType, 'AND')
diff --git a/core/tests/Drupal/Tests/Core/Menu/DefaultMenuLinkTreeManipulatorsTest.php b/core/tests/Drupal/Tests/Core/Menu/DefaultMenuLinkTreeManipulatorsTest.php
index 90b189d68fe172c490188affce861bb07d7c3ea0..cab6d78e1f320bea1eb68cf294a516b4f5f1fb86 100644
--- a/core/tests/Drupal/Tests/Core/Menu/DefaultMenuLinkTreeManipulatorsTest.php
+++ b/core/tests/Drupal/Tests/Core/Menu/DefaultMenuLinkTreeManipulatorsTest.php
@@ -5,6 +5,8 @@
 use Drupal\Core\Access\AccessResult;
 use Drupal\Core\Cache\Context\CacheContextsManager;
 use Drupal\Core\DependencyInjection\Container;
+use Drupal\Core\Entity\EntityStorageInterface;
+use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Menu\DefaultMenuLinkTreeManipulators;
 use Drupal\Core\Menu\MenuLinkTreeElement;
 use Drupal\Tests\UnitTestCase;
@@ -34,11 +36,11 @@ class DefaultMenuLinkTreeManipulatorsTest extends UnitTestCase {
   protected $currentUser;
 
   /**
-   * The mocked query factory.
+   * The mocked entity type manager.
    *
-   * @var \Drupal\Core\Entity\Query\QueryFactory|\PHPUnit_Framework_MockObject_MockObject
+   * @var \Drupal\Core\Entity\EntityTypeManagerInterface|\PHPUnit_Framework_MockObject_MockObject
    */
-  protected $queryFactory;
+  protected $entityTypeManager;
 
   /**
    * The default menu link tree manipulators.
@@ -71,11 +73,9 @@ protected function setUp() {
     $this->currentUser = $this->getMock('Drupal\Core\Session\AccountInterface');
     $this->currentUser->method('isAuthenticated')
       ->willReturn(TRUE);
-    $this->queryFactory = $this->getMockBuilder('Drupal\Core\Entity\Query\QueryFactory')
-      ->disableOriginalConstructor()
-      ->getMock();
+    $this->entityTypeManager = $this->getMock(EntityTypeManagerInterface::class);
 
-    $this->defaultMenuTreeManipulators = new DefaultMenuLinkTreeManipulators($this->accessManager, $this->currentUser, $this->queryFactory);
+    $this->defaultMenuTreeManipulators = new DefaultMenuLinkTreeManipulators($this->accessManager, $this->currentUser, $this->entityTypeManager);
 
     $cache_contexts_manager = $this->prophesize(CacheContextsManager::class);
     $cache_contexts_manager->assertValidTokens()->willReturn(TRUE);
@@ -300,10 +300,14 @@ public function testCheckNodeAccess() {
     $query->expects($this->once())
       ->method('execute')
       ->willReturn(array(1, 2, 4));
-    $this->queryFactory->expects($this->once())
-      ->method('get')
-      ->with('node')
+    $storage = $this->getMock(EntityStorageInterface::class);
+    $storage->expects($this->once())
+      ->method('getQuery')
       ->willReturn($query);
+    $this->entityTypeManager->expects($this->once())
+      ->method('getStorage')
+      ->with('node')
+      ->willReturn($storage);
 
     $node_access_result = AccessResult::allowed()->cachePerPermissions()->addCacheContexts(['user.node_grants:view']);