saritasa-nest / saritasa-dotnet-tools

Development Tools For Company'S .NET Projects.
BSD 2-Clause "Simplified" License
27 stars 13 forks source link

Messages: Do not Record Nested Messages #69

Closed krasninja closed 3 years ago

krasninja commented 5 years ago

When you add a repository to pipeline it logs every command/query that passes thru. However, sometimes a client may run a command within command. It may increase messages log and makes it hard to use as event sourcing. Add option to the repository to do not log nested messages.

Example: AddUserCommand runs UpdateStatistic. In the current implementation in messages log you would see two messages in a log. Expected to have only AddUserCommand one.

Proposal: Add a new property AddNestedMessages (true by default) to RepositoryMiddleware. You can use this code for scope: https://github.com/Saritasa/SaritasaTools/blob/3d29320ee678a92d4c6f0195d3fddf6522133589/src/Saritasa.Tools.NLog4/LoggerScope.cs