diff --git a/src/Umbraco.Tests/Surface/SurfaceControllerAreaTests.cs b/src/Umbraco.Tests/Surface/SurfaceControllerAreaTests.cs
new file mode 100644
index 0000000000..96fde34574
--- /dev/null
+++ b/src/Umbraco.Tests/Surface/SurfaceControllerAreaTests.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Umbraco.Tests.Surface
+{
+ public class SurfaceControllerAreaTests
+ {
+ }
+}
diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj
index a4a7b46302..09c1e80977 100644
--- a/src/Umbraco.Tests/Umbraco.Tests.csproj
+++ b/src/Umbraco.Tests/Umbraco.Tests.csproj
@@ -70,6 +70,7 @@
+
diff --git a/src/Umbraco.Web/AreaRegistrationExtensions.cs b/src/Umbraco.Web/AreaRegistrationExtensions.cs
index ccdf7d6395..ba9697246f 100644
--- a/src/Umbraco.Web/AreaRegistrationExtensions.cs
+++ b/src/Umbraco.Web/AreaRegistrationExtensions.cs
@@ -59,6 +59,10 @@ namespace Umbraco.Web
//set the namespace of the controller to match
new[] { controllerType.Namespace });
+ //TODO: FIx this!!
+ //By setting the default this will always route even without specifying the surfaceId syntax in the URL,
+ // we need to unit test this and ensure it is correct
+
//set defaults
controllerPluginRoute.Defaults = new RouteValueDictionary(
new Dictionary
diff --git a/src/Umbraco.Web/Mvc/SurfaceController.cs b/src/Umbraco.Web/Mvc/SurfaceController.cs
index 5b7c38a6ce..a4ceeed4f6 100644
--- a/src/Umbraco.Web/Mvc/SurfaceController.cs
+++ b/src/Umbraco.Web/Mvc/SurfaceController.cs
@@ -6,6 +6,15 @@ using Umbraco.Core;
namespace Umbraco.Web.Mvc
{
+ [SurfaceController("DD307F95-6D90-4593-8C97-093AC7C12573")]
+ public class TestSurfaceController : SurfaceController
+ {
+ public ActionResult Index()
+ {
+ return Content("hello");
+ }
+ }
+
///
/// The base controller that all Presentation Add-in controllers should inherit from
///
diff --git a/src/Umbraco.Web/Mvc/SurfaceControllerArea.cs b/src/Umbraco.Web/Mvc/SurfaceControllerArea.cs
index 9712cd547d..7ac8b29ee8 100644
--- a/src/Umbraco.Web/Mvc/SurfaceControllerArea.cs
+++ b/src/Umbraco.Web/Mvc/SurfaceControllerArea.cs
@@ -39,7 +39,7 @@ namespace Umbraco.Web.Mvc
var areaName = GlobalSettings.UmbracoMvcArea;
//local surface controllers do not contain the attribute
- var localSurfaceControlleres = surfaceControllers.Where(x => TypeExtensions.GetCustomAttribute(x.GetType(), false) == null);
+ var localSurfaceControlleres = surfaceControllers.Where(x => x.GetType().GetCustomAttribute(false) == null);
foreach (var s in localSurfaceControlleres)
{
var meta = s.GetMetadata();
diff --git a/src/Umbraco.Web/Mvc/SurfaceControllerAttribute.cs b/src/Umbraco.Web/Mvc/SurfaceControllerAttribute.cs
index 8facd8ed91..ac08ca9886 100644
--- a/src/Umbraco.Web/Mvc/SurfaceControllerAttribute.cs
+++ b/src/Umbraco.Web/Mvc/SurfaceControllerAttribute.cs
@@ -10,9 +10,17 @@ namespace Umbraco.Web.Mvc
{
public Guid Id { get; private set; }
- public SurfaceControllerAttribute(Guid id)
+ public SurfaceControllerAttribute(string id)
{
- Id = id;
+ Guid gid;
+ if (Guid.TryParse(id, out gid))
+ {
+ Id = gid;
+ }
+ else
+ {
+ throw new InvalidCastException("Cannot convert the value " + id + " to a Guid");
+ }
}
}
}
\ No newline at end of file