Business Logic Problem
Hi everyone!
I have a business logic problem, I'm developing a financial management application, but whenever I make accounts releases creating a register, for example an outcome of 50 dollars, I have to create a release register in my registers collection (I'm using MongoDB) and update the account balance which is in another collection. My question is how can I separate the registers logic from the account logic? I want to make some kind of observer and whenever the register is created or modified I want the account to be notified and changed too. Here is how my entities look like and my services are looking good except from the register service which is a mess because I'm also changing the accounts there.
3 Replies
How do your services look?
$code
To post C# code type the following:
```cs
// code here
```
Get an example by typing
$codegif
in chat
For longer snippets, use: https://paste.mod.gg/My code is big and confusing, I'm trying to implement the command pattern to break it down and I took an example from this site https://refactoring.guru/design-patterns/command/csharp/example#lang-features, maybe a observer pattern would be helpful. There are a lot of repetition and processes that look very similar but the properties or actions are different, any suggestion on how to improve it would be very nice, here is the link for the code I think (I don't really know how this site works): https://paste.mod.gg/kcntijnnthys/2
BlazeBin - kcntijnnthys
A tool for sharing your source code with the world!
Command in C# / Design Patterns
Command pattern in C#. Full code example in C# with detailed comments and explanation. Command is behavioral design pattern that converts requests or simple operations into objects.