multi tenant dbcontext RRS feed

  • Question

  • User-350307771 posted

    Hello there.

    I am developing a multi tenant application. I keep customers on Db1Context and this customers data on Db2Context.

    D2Context will have a private database for each client.

    For example, I created a subdomain https://tenant1.mysite.com - https://tenant2.mysite.com - tenant3,4,5. But

    I could not get the value of request.host. returns null all the time. In short, how should I go about creating a separate database structure for a single application and each customer?

    I searched a lot on google. but none of them provided a solution. I'm using asp.net core 5.0. thanks.

    Monday, March 1, 2021 2:11 PM

All replies

  • User503812343 posted

    As you are going to have a different structure and database for each customer however you have the same application for all clients.

    You should develop a microservice for each customer.

    For more info on microservice architecture - https://geeksarray.com/blog/microservice-architecture-pattern-for-architects

    Monday, March 1, 2021 2:30 PM
  • User-474980206 posted

    If the host is empty, then probably yours server is behind a firewall or balance server. This can be configured to pass the actual host header.

    Monday, March 1, 2021 4:31 PM