0

I am trying to create a .NET core application that connects to multiple databases.

I need 2 different context, one of them will connect to a database and the other context has to connect to multiple databases (with the same schemma).

I've created both context but i have problems chaning the connection string for the second context.

Ex: I have an api mehtod that recieve the ID of a product and i have to search that product with the first context and then, depending on the token, update that product on a specific database on the second context

  • Does this answer your question? [Entity Framework to multiple databases (same schema) at runtime?](https://stackoverflow.com/questions/1257107/entity-framework-to-multiple-databases-same-schema-at-runtime) – Anders Marzi Tornblad May 20 '21 at 09:10
  • Does this answer your question? [Connect multiple Databases to .NET core project via Entity Framework Core](https://stackoverflow.com/questions/58123230/connect-multiple-databases-to-net-core-project-via-entity-framework-core) – Peter O. May 20 '21 at 09:44

1 Answers1

0

You can take two-parameter in DBcontext class.

Check this out:

Connect multiple Databases to .NET core project via Entity Framework Core

Kashyap
  • 48
  • 3