C
C#11mo ago
FraznoFire

best way to handle multiple codebases interacting with same db?

Hi everyone, I’m working on a “bank” project that has two codebases, the first is an ASP.NET based API that the website front end interacts with, and the second is an Azure Functions based service worker that is used to run scheduled tasks, such as interest payments. Both use EF Core to talk to the DB Essentially, I have the API ready to go, but it has several data validation checks when interacting with the database, such as source account has enough currency to cover the transaction etc. I’m not sure what would be the most scalable way to replicate that code to the Azure Function, so that if I make any changes to the model used or something, how can I make sure that the function’s code stays in sync without manually copying it across? Here’s a basic diagram of the app if that helps clear it up:
No description
3 Replies
mtreit
mtreit11mo ago
Usually you move common code to a shared library and both codebases reference that library.
FraznoFire
FraznoFireOP11mo ago
Didn’t even think of that! Now I just need to work out how to do that..
mindhardt
mindhardt11mo ago
You can make a separate project and either publish it as nuget or have a git submodule
Want results from more Discord servers?
Add your server