I'm currently working on a project and for some strange reason I have to use 32 different SQL Server databases with the same model. These databases have different information but the same exact design.
For some stupid requirement I can't unify these databases. My problem is that I have to implement some Rest services in C# using EF Core 2.2 that perform queries on these databases.
I suspect that if I create a context for each database, the performance of my services is going to be terrible. I'm right? I wonder if there is an efficient / elegant solution for doing this.
If they all have the same structure (same tables, tables have same properties, etc), then you can have one DbContext but change the connection string on the fly based on which one you are querying. It's easy enough to pass in the connection string to a DbContext, but the exact implementation will depend on what all you're doing.