title: EF core and ASP.NET Core with a schema based multitenancy
body: <p>I am building and App with ASP.NET core and EF core. I want to implement a schema based multitenancy using a single database. Each schema in my database will consist of the same set of tables with the same names, so all the schema share the same structure. But the schema names are not known in advance since I want to create them dynamically in my APP.</p>
  
  <p>I read this <a href="https://medium.com/swlh/entity-framework-core-multitenancy-112d82cd89c6" rel="nofollow noreferrer">blog article</a> where the author presents a method that uses  <a href="https://docs.microsoft.com/en-us/ef/core/what-is-new/ef-core-3.0/#interception-of-database-operations" rel="nofollow noreferrer">IDbCommandInterceptor</a> but modifying the SQL in this way could bring a lot of issues such as security issues or making requests to fail.</p>
  
  <p>How can I dynamically specify in the DBContext, which schema to use (based on the received request) so that the data are saved and retrieved from this specified schema?</p>