Following the discussion in T211800, assuming for now a single entity type can only be provided by single Wikibase instance, make it possible for wikibase to access entities provided by multiple sources.
For now, only direct database database access is considered.
The general idea would be to define "sources" that are providing entities of particular type. Services providing access to entity data will be defined per source (i,e. a particular service is configured to access the database of given source/instance/repository). Wikibase will determine which source-specific service to use to access data of particular entity based on the entity-type vs source configuration.
Entity ID prefixes are not considered for now, as long as there is no technical need (state January 2019) to have a single entity type provided by multiple Wikibase instances/sources./databases.
------------
**Update January 2020:**
The implementation of "entity-source-based federation" is almost completed (remaining changes have related patches on gerrit) Wikibase Repo "component" (enabled instead of "repository-prefix-based" one using configuration setting), and also close to complete in the Wikibase Client "component".
After finishing the implementation, the remaining step to complete this work would be to remove the "use entity source based federation" setting and disable the possibility to use "repository-prefix-based federation". Consequently all code paths related to "repository-prefix-based federation" would be dropped.
The known remaining steps are listed below (list not complete as of 2020-01-15, being continuously updated) - note the list is broken in the ordered "steps", order of items in the "step" might be arbitrary
[x] Repo: adjust `WikibaseRepo::getLocalEntityTypes`: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Wikibase/+/494051 +2ed
[x] Repo: adjust `WikibaseRepo::newValidatorBuilders`: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Wikibase/+/494052 +2ed
[x] Repo and Client: adjust constructing of `Generic Servicers`: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Wikibase/+/494650 +2ed
[x] Repo: adjust `WikibaseRepo::getEnabledEntityTypes`: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Wikibase/+/494651 +2ed
[x] Repo: adjust (private) `WikibaseRepo::getVocabularyBaseUri`: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Wikibase/+/564976 +2ed
[x] Repo: Allow to prefix the value namespace in RDF output: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Wikibase/+/533202 +2ed
[ ] {T243184}
[ ] {T243185}
[ ] {T243186}
[ ] {T243187}
[ ] {T243188}
...
[ ] Switch the default value of the `useEntitySourceBasedFederation` to true in both Repo and Client
...
[ ] Remove `useEntitySourceBasedFederation` setting
[ ] Remove all conditional code paths in Repo and Client that were differing depending on the value of `useEntitySourceBasedFederation` setting
[ ] Repo: Rename `Wikibase::getEntityTypeToRepositoryMapping` - given "repository" concept will be gone
...
[ ] Remove the logic setting up "entity source" config from "legacy" setting options (`repositories`, `foreignRepositories`, `conceptBaseUri`, `entityNamespaces`, ...)
...
[ ] Remove `PerRepositoryServiceContainer` and `MultipleRepositoryAwareWikibaseServices`
[ ] Remove `RepositoryDefinitions`
[ ] (possibly optional) Remove `EntityId::getRepositoryName` and "repository prefix" related code in Wikibase Data Model library
...