© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
9 replies
coado

Databases load balancing

Hey everyone,
I have to create a load balancer between databases. I am using EF core to build queries and manage database connections. I wonder if changing the database connection in interceptors is possible. For example, I have a DBContext instance connected to database1, and in the interceptor, I want to run a round-robin algorithm that will change the connection between database1, database2, etc.

The second approach that came to my mind is to create a proxy that will act as a "database" (it will listen for queries). It would redirect the requests between multiple real databases. I will connect DBContext to my proxy in my server that uses EF Core. I am unsure if it's possible and how to go about this.

I am new to C# and this is my assignment for university, so any help is appreciated. Thanks!


Hey everyone,
I have to create a load balancer between databases. I am using EF core to build queries and manage database connections. I wonder if changing the database connection in interceptors is possible. For example, I have a DBContext instance connected to database1, and in the interceptor, I want to run a round-robin algorithm that will change the connection between database1, database2, etc.

The second approach that came to my mind is to create a proxy that will act as a "database" (it will listen for queries). It would redirect the requests between multiple real databases. I will connect DBContext to my proxy in my server that uses EF Core. I am unsure if it's possible and how to go about this.

I am new to C# and this is my assignment for university, so any help is appreciated. Thanks!
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

practicing on mutliple databases
C#CC# / help
2y ago
Merge two separate databases
C#CC# / help
3y ago
❔ blazor wasm 6 databases
C#CC# / help
3y ago