Accessing Private Methods and Properties in Sitecore using Reflection

Oh Sitecore, you and your crazy Kernel. Such beauty and craziness all rolled into one. So much extensibility yet so many hoops you make us jump through to play with you nicely. Inevitably we end up just decompiling you just to take a look at the beauty that exists inside, but at the same time you cause pain when that extensibility is not at the point we need.

So what’s a guy to do? We resort to tactics that make us feel dirty: copy and paste!

All you Sitecore developers know what I am talking about. You need to override a pipeline, or extend an event handler or change the behaviour of some part of the interface and you try you damned hardest to extend in a clean way without touching any of those Sitecore parts, but there’s just no way you can do it. The method you need access to is Private, or only internal, marked as static or was not made access.

Read More