FunctionMonkey icon indicating copy to clipboard operation
FunctionMonkey copied to clipboard

MediatR Behaviors support

Open pizycki opened this issue 5 years ago • 3 comments

Hi, is it possible to add MediatR Pipeline Behaviours with Function Monkey?

FM @ 0.37

pizycki avatar Feb 20 '20 16:02 pizycki

I've just found the use of ICustomDispatcher. https://github.com/JamesRandall/FunctionMonkeyVideoSeries/blob/master/Part5/ServerlessBlog/CrossCuttingConcerns/CustomDispatcher.cs

What I'm trying to achieve is provide trace logging for all my command handlers.

So implementing ICustomDispatcher would be the best option now, right? :)

BTW, this project is great 👍

pizycki avatar Feb 20 '20 17:02 pizycki

Planning to test that this weekend (if possible). Specifically, I'm wanting it for efcore and using mediatr pipeline begintransaction/committransaction. Will let you know when i test it. Overall, commanding is a decent command handler. The other two issues i found that I had issues (in comparison with mediatr) is templating, something like

public class CommandTemplate<TCommand, TResponse> : IRequest<TResponse> where TCommand : IRequest<TResponse>

Was having issues getting it to work with commanding. That said, I may have done something stupid. I iddn't spend a ton of time yet in testing it.

Oh, and last, this is really really minor... lot of files, I'll put both command, commandhandler, response all in one file... lot of times all within same class. Mainly, it's easy to support/debug them. Well, as long as it is only that, and calling the logic out of it somewhere else. That said, you can just make the parent class being the end of the namespace then just have the classes being in the file (without being a children class of the parent). This is more on the compiler though, and i dont think it needs fixed. Just somethign i'm used to doing, but again, namespace does same thing.

mdg215199 avatar Feb 21 '20 05:02 mdg215199

@pizycki sorry for state above and for not follow through yet. been side tracked last week and half due to life being life at times. i'm hoping to test this sometime this week, but will do so soon and will let you know.

mdg215199 avatar Mar 02 '20 01:03 mdg215199