Skip to content

Documentation about using sharding with ASP.NET Core and EFCore #2450

@pmeems

Description

@pmeems

For 5 years we have a .NET v4.6 application using EF6 and sharding. This is an internal application hosted by Azure used by a dozen users.
When a user creates a new client, the application saves the client details in the client table in the Master database, next it creates a new shard/tenant database. All other data of this client will be saved in this new database.
We use more or less this code example: https://docs.microsoft.com/en-us/azure/sql-database/sql-database-elastic-scale-use-entity-framework-applications-visual-studio

At this moment I'm rebuilding the application using .NET Core, Blazor, and EFCore. I managed to migrate most of the code pieces except for the sharding part.
My code is available at https://bitbucket.org/pmeems/matblazorgooglegsuite/src/develop/

As I see it, the difference between my .NET Core application and my .NET classic application is how the tenant context is created.
For .NET Core, I need to do something in startup.cs.
I also asked about this at StackOverflow: https://stackoverflow.com/questions/61632457/how-to-use-database-sharding-with-ef-core-and-c
David Browne (from Microsoft) is at least suggestion it should be possible but is only showing parts of what I should do.

We also use MultiShardConnection to search for employees in all client databases. It's not clear to me as well what the EFCore counterpart is.

What I'm looking for is a full example of how to implement sharding with .NET Core and EFCore.
I can't find any examples. I did find other people asking similar questions and not finding any answers either.

I'm stuck with this for weeks now. Any guidance will be much appreciated.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions