Skip to main content

Posts

Showing posts from 2011

Umbraco 5 Surface Controller

In a recent post I blogged my first steps in creating plugins for Umbraco 5 - creating a tree and editor using a custom hive provider for a third party database, in order to present and edit information within the Umbraco back office.

I noted how the information could also be made available on the front-end of the site by writing code within the razor view template. Whilst that worked, it wasn't very satisfactory and certainly wasn't the MVC way with too much code and logic in the view.

Since then the project has moved on and details have been made available for working with surface controllers. They can be created both directly within the Umbraco project in VS.Net or as plugins.

Creating a Surface Controller

To create a surface controller for use in a plug-in you create a class within a project with a reference to System.Web.Mvc and Umbraco.CMS.Web, with the following setup:
Inherits from SurfaceControllerNamed with a suffix of "SurfaceController"Has a class attribute …

Creating an Umbraco 5 Hive Provider with Custom Tree and Editor Plugin

Having used Umbraco CMS on a couple of projects in the past and been very impressed with it, I’ve been keen to follow progress on version 5 (or “Jupiter”) – a rewrite of the code-base to use ASP.Net MVC. In particular I’ve been looking recently at some of the extension points of the platform.

One of these is building upon the data access abstraction layer that is being developed for Umbraco 5 – known as Hive. Umbraco itself will use NHibernate for data access, but via the Hive abstraction. The idea is that this default data access method could be swapped out – but perhaps more importantly by building a hive provider developers can expose other data sources to their Umbraco templates and back office.

The back-office itself is also very pluggable, with the various node trees and editor interfaces also being extendable with your own custom implementations. In light of this I’ve been looking at a small project to create a hive provider for a custom database, along with a custom tree and…

Upgrade ASP.Net MVC2 to MVC3

Having recently upgraded a couple of ASP.Net MVC 2 projects to MVC 3, I came across a couple of tools and techniques to simplify the process.

ASP.Net MVC3 requires .Net 4 and hence use of VS.Net 2010 (or express editions) are required. There's also an additional download of the MVC3 framework required too.

One of the simplifying changes of the upgrade is a slimmed down web.config file - but I found this meant an in-place upgrade of this and all the necessary references rather complicated. So instead I created a new, empty MVC3 project and copied over all the controllers, models, views and necessary web.config settings into the new project.

An important security update is to HTML encode all output by default, using the new <:= > syntax (as opposed to <%= %>). If you've been encoding output properly in previous versions any potentially insecure content would have been wrapped in Html.Encode methods. But updating all of these to the new syntax looks to be a pretty ti…