single-tenant
I need some help, please. I know it is a long shot. I need every hotel to be its own db, but not to create a new db. At the moment when I create a new hotel, it creates the same database. Is there a way to do it properly? I would love some guidance or ideas. I appreciate any help you can provide.
Single-Tenant Architecture Data Isolation: Each hotel has its own database, ensuring that its data is completely separated from others. Security: Reduced risk of data leakage between tenants. Customization: Customize the database schema or settings for each hotel without affecting others.
Single-Tenant Architecture Data Isolation: Each hotel has its own database, ensuring that its data is completely separated from others. Security: Reduced risk of data leakage between tenants. Customization: Customize the database schema or settings for each hotel without affecting others.

21 Replies
I need every hotel to be its own db, but not to create a new db.
this sentence contradicts itself, what do you want the end result to be?
where did you get stuck when we left off the last time you asked about this?
this is also seems to be the exact opposite of single-tenant, this is multi-tenant@Jimmacle Hi sorry, I know it is confusing, yes, this is multi-tenant I have started it that way, but I realize it should not be that way, so now I am trying to re-factor it to single-tenant
but these 2 things don't make sense to say at the same time

every bullet point you put under "single-tenant architecture" is a quality of a multi-tenant architecture
sorry for the confusion, I meant it was a multi-tenant, and I want to re-factor it to single-tenant architecture
so what are you currently having a problem changing?
Yes, currently, trying to understand how to change it basically,
the way I have started is totally wrong
I am out of ideas already
without detail about what currently happens and what the desired behavior is i can't offer much advice
if you're creating a db per hotel and don't want to do that, the solution is essentially "don't do that"
Right, yes, it is a bit confusing to me, because it is creating new db, however it is exaclty the same as previous one, and when I edit the new db e.g new hotel, all hotels are changing event if it is new db which is confusing, not sure if I can post the hotel controller and hotel service, just advice how I can re-factor it ?
maybe the claryfying quesiton would do I still need to create the MDF file
kinda sounds like you are having troubles with auto migration of EF?
but this is just a long shot
how do we know how to help you if you dont give us anything to work with
sorry about that, not sure what to share, as it is quite a lot, is ok to share the github repo, or just, the Hotel Service and Hotel controller where the methods are ?
sorry about that, not sure what to share, as it is quite a lot, is ok to share the github repo, or just, the Hotel Service and Hotel controller where the methods are ?
Here are the Hotel Services, and HotelController
and configuration, file form Migrations folder
public Configuration()
{
AutomaticMigrationsEnabled = true;
AutomaticMigrationDataLossAllowed = true;
}
If you could point me to how to refactor it, I would be very thankful, trying to re-factor it from weeks, but still no luck
yes but what behavior exactly do you want to change?
The best behavior for me is when a new hotel is created, to support single-tenancy so use one db for all hotels added, where each hotel is isolated, and when making changes, the changes are only on this hotel
so just don't make additional dbs
that's an intentional behavior you've put in your code
the rest is just simple relational database management
yep, I did try it, however not sure how to do the relational dabase management,
what specifically are you struggling with? we can only help with specific questions, vague problem statements don't get us anywhere
Yes, I realize that as well, just trying to figure it out