C
C#2w ago
Georgi Y

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.
No description
21 Replies
Jimmacle
Jimmacle2w ago
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
Georgi Y
Georgi YOP2w ago
@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
Jimmacle
Jimmacle2w ago
but these 2 things don't make sense to say at the same time
No description
Jimmacle
Jimmacle2w ago
every bullet point you put under "single-tenant architecture" is a quality of a multi-tenant architecture
Georgi Y
Georgi YOP2w ago
sorry for the confusion, I meant it was a multi-tenant, and I want to re-factor it to single-tenant architecture
Jimmacle
Jimmacle2w ago
so what are you currently having a problem changing?
Georgi Y
Georgi YOP2w ago
Yes, currently, trying to understand how to change it basically, the way I have started is totally wrong I am out of ideas already
Jimmacle
Jimmacle2w ago
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"
Georgi Y
Georgi YOP2w ago
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
ACiDCA7
ACiDCA72w ago
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
Georgi Y
Georgi YOP2w ago
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 ?
Georgi Y
Georgi YOP2w ago
Here are the Hotel Services, and HotelController
Georgi Y
Georgi YOP2w ago
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
ACiDCA7
ACiDCA72w ago
yes but what behavior exactly do you want to change?
Georgi Y
Georgi YOP2w ago
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
Jimmacle
Jimmacle2w ago
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
Georgi Y
Georgi YOP2w ago
yep, I did try it, however not sure how to do the relational dabase management,
Jimmacle
Jimmacle2w ago
what specifically are you struggling with? we can only help with specific questions, vague problem statements don't get us anywhere
Georgi Y
Georgi YOP2w ago
Yes, I realize that as well, just trying to figure it out

Did you find this page helpful?