Data isolation for Modular Monoliths - DB Schemas, EF Core
Вставка
- Опубліковано 30 чер 2024
- ☄️ Master the Modular Monolith Architecture: bit.ly/3SXlzSt
📌 Accelerate your Clean Architecture skills: bit.ly/3PupkOJ
🚀 Support me on Patreon to access the source code: / milanjovanovic
A modular monolith is an architectural pattern that structures the application into independent modules or components with well-defined boundaries. The modules are split based on logical boundaries, grouping together related functionalities. This approach significantly improves the cohesion of the system.
In this video, I'll explain why data isolation between modules is important and explore how we can implement logical data isolation using schemas.
What Is a Modular Monolith?
www.milanjovanovic.tech/blog/...
Monolith to Microservices: How a Modular Monolith Helps
www.milanjovanovic.tech/blog/...
Modular Monolith Communication Patterns
www.milanjovanovic.tech/blog/...
Modular Monolith Data Isolation
www.milanjovanovic.tech/blog/...
Join my weekly .NET newsletter:
www.milanjovanovic.tech
Read my Blog here:
www.milanjovanovic.tech/blog
Chapters
0:00 Modular Monolith data isolation
2:16 Adding database Schemas with EF Core
6:46 Fixing the SQL queries
8:45 Creating EF Core SQL migration scripts
9:59 Adding EF migration history to the schema
11:24 Fixing the Outbox processor
14:46 Enforcing data isolation? - Наука та технологія
𝗣.𝗦. If you liked this, you will love The .NET Weekly newsletter. Join 49,000+ engineers here → bit.ly/3Qx7Cu5
Why go through the trouble of making the schema a constant for the migration, only to hard-code it in all the queries?
Meh, just wanted to make things explicit for the raw SQL example. All it takes is move the constant one level below, and reuse it.
Great video ..thanks a lot
You are welcome!
Hi Milan... Great video... Would you use the same approach if you have different databases for each module?
Different SQL database? Using schemas could still make sense.
Hello Milan! Thank you very much for your videos! Are you familiar with the actor model of programming? For example, about an application written using Akka? Can you release a video about this? It would be very interesting
I think Akka would be interesting, yes :)
Great video 👍
But I still wonder - is there any other option for outbox messages table instead of code duplication?
Expanding the abstraction, and passing in the respective schema
@@MilanJovanovicTech How about using only one OutboxMessages table (in public schema, for example) with only one processor?
@@artemissterio it's ok too - depends on how modules are busy :)
Great video.
How about creating video about prometheus or loki ? Can be in combination with Grafana for better data visualization.
Going to cover OTel + Aspire first
great video.
wouldn't it be better to have one module that handles all the outbox messages? if I have N modules I have N background jobs if performance might decrease.
That would introduce coupling, though. Depends on what you want. Also, having one outbox processor would decrease the overall throughput.
Hi Milan, thanks a lot as always for your videos, love them !
I'm interested by your course about the MMA, and I was wondering if you'd consider uploading it on platforms like Udemy ?
thanks for helping
It won't be coming to Udemy
I don't know if I'm missing something, but you are using Hangfire for further processing outbox messages? If that is so, Hangfire should already have it's own schema or database, so why don't you just write common integrations service to process outbox messages, since if you are using Hangfire (which is external service) it can't be domain event.
Hangfire/Quartz/Hosted service, it's an implementation detail mostly
If we have seperate databases per Module then incase while querying we gonna needs to fetch data from a table which is inside anotherr database ??
Try not to mix queries from different modules
@@MilanJovanovicTech
Ok
Let take one example here milan
I have modules like
Patient Demographics
Appointments
Reports
In such case, I can make above modules as SubModules under Module Reception .
By this, I can have all related tables under one Module.
Is that correct ?
Arent modular monoliths just monoliths but with good system design?
Kind of: www.milanjovanovic.tech/blog/what-is-a-modular-monolith