mhinze / ShortBus

In-process mediator with low-friction API
MIT License
210 stars 41 forks source link

QueryHandler.Handle overloading bug #11

Closed kmc059000 closed 10 years ago

kmc059000 commented 10 years ago

I encountered an issue where I had a class which needed to implement multiple versions IQueryHandler. The current implementation throws an AmbiguousMatchException when the GetMethod("Handle") is called in Mediator because there were multiple overloads of the Handle method.

Because the Mediator Send method does not use reflection, this issue does not exist when a class implements multiple versions of ICommandHandler.

After I made the change for allowing overloading the Handle method, I noticed the results from the Perf test were approximately twice as slow. To remedy this, I added logic for caching the MethodInfo instances the first time they are retrieved. The Perf test results were comparable to master after adding the caching, albeit a hair slower.

kmc059000 commented 10 years ago

Oops, not trying to steal @dvins thunder. I didn't see his pull request before I did mine. I actually like his implementation better.

mhinze commented 10 years ago

Thanks for this. I think there is still room for performance improvements in this vein. It would be nice to get a proper benchmark set up, maybe using https://github.com/phatboyg/Benchmarque