Support MySQL multiple databases/tables sharding
Support MySQL multiple databases/tables sharding in the same model. see my article about this.
In MySQL, physically, a schema is synonymous with a database. You can substitute the keyword SCHEMA instead of DATABASE in MySQL SQL syntax, for example using CREATE SCHEMA instead of CREATE DATABASE. Some other database products draw a distinction. For example, in the Oracle Database product, a schema represents only a part of a database: the tables and other objects owned by a single user.
So, for the simplify, MySQL can only dynamically change the SCHEMA at runtime, but for other databases, I need time to change the EF Core code. However, I'm so busy.
Have a initial commit about this @7678a6e
Had published a package for this feature, please install v1.1.2.
You can inject the IConfigurationRoot into the register IServiceCollection method, so you can use your connectionstring during the register. I'm working on a fork to add the Include & ThenInclude methods for EF Core
@ArjanL Inject the IConfigurationRoot only solve the multiple databases sharding (in the same machine or different machine), that's mean cannot solve the multiple table sharding, assume the following cases:
- Per database per country (Different country's user in different databases)
- Per table per month (Different Order table for the same user)