We have moved to GitHub Issues
Created by Robert 12 Apr 2013, 02:36:51 Updated by Shannon Deminick 16 Apr 2013, 15:07:47
Not sure if this is an issue with Umbraco or the third party library we are using (AttributeRouting) but we are having issues with the registered UmbracoApiController routes.
The issue for us is the namespaces data token which you guys set as a single string.
route.DataTokens.Add("Namespaces", meta.ControllerNamespace); //look in this namespace to create the controller
Whereas best practice may suggest it should be an array of strings
route.DataTokens.Add("Namespaces", new string ); //look in this namespace to create the controller
To me this is an issue with mvc routing being too vague but I thought I would raise it with you guys all the same - we have raised it with the AttributeRouting guys too.
Good spot! I'll fix up asap
Great thanks Shannon. Slightly off topic but can you tell me what the purpose of surfacecontrollers are anymore - as opposed to a regular native controller? Other than for convenience maybe.
@Robert, SurfaceControllers are auto-routed and contain all of the Umbraco properties and contexts that you need to use to work with Umbraco. Eventually we'll create a 'child action macro' type which will be based on SurfaceController's as well. You can of course just use regular controllers and route them yourself but you'll be accessing all of the singleton objects directly instead of using the base class's properties to access the Umbraco contexts which isn't as nice. Also BeginUmbracoForm only works with Surface Controllers. You can see the doc here describing what a surface controller does: http://our.umbraco.org/documentation/Reference/Mvc/surface-controllers
Fixed in b5920ee87546
Great stuff - look forward to grabbing 6.1.0 now. As for the SurfaceControllers - so long as the APIs are available publicly and statically (which they have to be right?) - I will stick to plain old controllers unless I am making a package/plugin.
@Robert, the only thing to note about Html forms and custom controllers is that they won't integrate directly within the Umbraco routing pipeline. Of course you can still use your own custom controllers for forms and post to them and return your own custom views but you won't be able to return a current umbraco page with the correct model state to work with validation. Surface controllers give you a bunch of additional methods for dealing with this like return CurrentUmbracoPage() return RedirectToCurrentUmbracoPage() return RedirectToUmbracoPage(..) etc... Creating forms in MVC with Umbraco is listed here: http://our.umbraco.org/documentation/Reference/Mvc/forms
Assignee: Shannon Deminick
Backwards Compatible: True
Affected versions: 6.1.0
Due in version: 6.1.0