UnitOfWork icon indicating copy to clipboard operation
UnitOfWork copied to clipboard

Support MySQL multiple databases/tables sharding

Open rigofunc opened this issue 8 years ago • 4 comments

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.

rigofunc avatar Mar 26 '17 02:03 rigofunc

Have a initial commit about this @7678a6e

rigofunc avatar Mar 26 '17 03:03 rigofunc

Had published a package for this feature, please install v1.1.2.

rigofunc avatar Apr 19 '17 01:04 rigofunc

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 avatar May 06 '17 19:05 ArjanL

@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:

  1. Per database per country (Different country's user in different databases)
  2. Per table per month (Different Order table for the same user)

rigofunc avatar May 07 '17 04:05 rigofunc