When you're developing a single-page app in Sitecore you'll most likely have to partially render a page and inject the rendered markup into your SPA. When you find yourself in this situation you might resort to using Devices, or you might use regular expressions. Either way will require you to request the page first, but the … Continue reading Making Single-Page App Work in Sitecore MVC
Get Rid of NULL Sitecore Field Checks
Null-check is a preventive measure to avoid exceptions during run-time, yet having a bunch of it all over your solution makes for a readability horror. Take the code below for example: It doesn't look like a lot of lines but imagine having to parse a bunch of fields throughout your development. Sure you can just … Continue reading Get Rid of NULL Sitecore Field Checks
Track Client-side Events in Sitecore MVC
Tracking events triggered on your site is obviously of vital importance to measure your visitors' behaviour and level of engagement. Sitecore does a good job of tracking events associated to a page that are triggered upon page visit - but in reality, we are more concerned about tracking client-side events especially since almost everything happens … Continue reading Track Client-side Events in Sitecore MVC
Using the Sitecore Database in Web API
Web API has no access to the current Sitecore Context your page is in. With that said, there's no stopping you from creating an instance of the database on the fly as long as you know which database your site is using. You can either create a config value so you know which database name … Continue reading Using the Sitecore Database in Web API
Rendering Sublayouts in Sitecore MVC
I have recently been tasked to plan for a Sitecore MVC transition in one of our projects, and to be honest it's a lot more work than I had imagined since our default ASPX layout file has a bunch of statically added Sitecore sublayouts in it which unfortunately will never run on a View file. Then it dawned … Continue reading Rendering Sublayouts in Sitecore MVC
Mocking Sitecore using MS Fakes
Mocking Sitecore has been a tough nut to crack since Sitecore lacks the necessary interfaces that common mocking frameworks need, which really screws up automated testing for a lot of us. For that we turn to isolation frameworks like TypeMock and Justmock which unfortunately come with a huge price tag. Thankfully Microsoft Fakes is here … Continue reading Mocking Sitecore using MS Fakes
Update local ASP.Net website without publish
With Visual Studio’s publish functionality you can conveniently preview how your web project behaves and looks like on your local IIS web server. With that said, I believe publishing makes sense only if you’ve done significant changes since, depending on how big your project is, it may take some time to sync your deployable project … Continue reading Update local ASP.Net website without publish