Modular Architecture is a set of principles and methodologies used in Sitecore Habitat to showcase Sitecores recommended best practices for solution architecture in a Sitecore solution. This is my second post on Modular Architecture and Sitecore Habitat. If you haven’t read the first post already you can read it here. What are layers in Modular Architecture? The concept of layers is a concept in Modular Architecture originally described in Pentia Component Architecture. ...
The groundbreaking Sitecore Habitat
Sitecore released a new demo site late September called Sitecore Habitat. There is nothing new in Sitecore supplying a demo site but this one is nothing less than groundbreaking, it is a real revolution in the way that Sitecore teaches developers to work with their product. In the latter days Sitecore would never explain how to structure your solution. They would merely supply limited demos showing how different functionality can be achieved using the Sitecore API. Nothing about how to structure a large solution that has to be easy to maintain over time. ...
How to extend placeholders in Sitecore MVC
Wow it has been ages since I last wrote a blog post so it is about time that I get started again. A colleague of mine asked me a question the other day about how I would implement a page(experience)-editable accordion spot where each element in the accordion is a rendering item. Kind of like shown below where the content in each accordion element is a rendering with its own datasource. You should be able to personalize and test each rendering individually. ...
Gzip WebApi Response Content using an attribute
Today I was asked why json responses from WebApi was not being gzipped since it brought down our score on Google Page Speed. So yet again I started my ongoing fight with Google Page Speed. It turns out that we had issues making IIS gzip application/json data. Since we do not have direct access to the production environment I decided that we would be better off simply gzipping the response content in code where and when we wanted to. ...
Comparing DI frameworks with Sitecore ReflectionUtil
As a follow up on my last post about IoC / DI containers and how to use the Sitecore API to perform inversion of control using ReflectionUtil, I’ve made a quick speed comparison of some common DI frameworks, Sitecores ReflectionUtil and the new keyword as the best case for how quick it is to instantiate an object. The results The table below shows how long time it took to resolve and instantiate 1000 instances of a type without using constructor or parameter injection and without any lifetime management. Ninject27.360421582498Unity2.73812495641971ReflectionUtil0.19632199878594Simple Injector0.0757655566157367new Keyword0.0386374153259534 I ran the test 10 times and the results that I show here are the median, ranking from worst in top to best in bottom. ...
Simple IoC container using only the Sitecore API
Lately there has been a lot of discussions on twitter about using different third party frameworks for Inversion of Control using Dependency Injection in Sitecore solutions. The arguments in these discussions can be almost religious, either for or against using a specific third party IoC framework. There are two extremes, on one side the developers who have just found IoC and now evangelize it wonders to the world and then on the other side we have developers who are either scared of IoC or have seen the hell it is when IoC frameworks are misused. ...
Working with custom MongoDB collections in Sitecore 8 using WebApi
The introduction of the xDB to the Sitecore eXperience Platform offer a ton of new options for us Sitecore developers. As a bonus we suddenly have a data store for anything at any time instead of either trying to make the data fit into Sitecore items or give up and go with a custom database. Now we can just use mongo for almost anything. In this post I will show how extremely simple it is to get and set data in a custom mongo collection. ...
Implementing a WebApi service using ServicesApiController in Sitecore 8
This will just be a quick post about implementing a WebApi controller in Sitecore 8 using the ServicesApiController class. Perhaps this post can help some of the teams in the ongoing Sitecore Hackathon, who knows. The ServicesApiController class Sitecore.Services introduce a new abstract class called ServicesApiController that derives from the System.Web.ApiController. The class itself only purpose is to identify an ApiController as being a Sitecore ServicesApiController. This identification is used by some WebApi filters that is added in the include config file Sitecore.Services.client.config ...
Securing the password recovery experience in Sitecore 8
Following my post on password recovery in Sitecore 8 fellow Sitecore MVP Kam Figy pointed out how the default Sitecore implementation potentially can be used by a malicious individual to block an editor from logging in by resetting their password automatically. This can be done simply by creating a script that request a new password for a known user name once every x minute/second. That would really annoy the victim and potentially also cause business havoc. ...
The amazing password recovery experience in Sitecore 8
Along with the new login screen in Sitecore 8 there is also a new implementation of password recovery for editors. In the old versions of Sitecore the /sitecore/login/default.aspx page redirected the user to a page called passwordrecovery.aspx. This page used an asp:PasswordRecovery asp.net standard webcontrol. Personally I never became fond of all of these standard but rather complex asp.net webcontrols back when they were released with .NET 2.0. They allowed you to really quickly get a demo site up and running with standard functionality but changing any behavior just a tiny bit to fit your domain specific needs or even design took much more effort than just to use simple webcontrols to build up the same functionality. I only know about most of these webcontrols due to old Microsoft certifications where you were forced to answer all questions like you used them all the time even though you always chose not to because of their inflexible design. ...