I'm starting to use MVC in umbraco and creating surfaceControlles/Partial views , I would like to start it with best practice. So where sould I create the controllers? I have the umbarco project in Visual Studio 2010, shall I create a foldet named Controllers? is it possible to create a new project in the same solution and create the controllers and views there and use them in Umbraco?
Ideally you should have business logic in a seperate project. So yes: create a new library project, reference Umbraco and create your Surface controllers in there under /Controllers folder. You can keep your corresponding views in the umbraco project.
Ensure your controller project .dll is in the umbraco /bin folder (using a post-build copy). Umbraco should then automatically pick it up, if it's an umbraco SurfaceController.
e.g assuming your solution has two projects:
Umbraco.Extensions (contains your Surface controller)
Umbraco.Website
Post build, copy the Umbraco.Extensions.dll from the project /bin folder, into the Umbraco.Website /bin folder.
Ideally you should set this up to be automated - if you're unsure about setting up a post build copy, let me know :)
SurfaceController where to put them?
Hi,
I'm starting to use MVC in umbraco and creating surfaceControlles/Partial views , I would like to start it with best practice. So where sould I create the controllers? I have the umbarco project in Visual Studio 2010, shall I create a foldet named Controllers? is it possible to create a new project in the same solution and create the controllers and views there and use them in Umbraco?
Thanks
Ideally you should have business logic in a seperate project. So yes: create a new library project, reference Umbraco and create your Surface controllers in there under /Controllers folder. You can keep your corresponding views in the umbraco project.
Hi Jade,
Thanks for your reply, one more question:
How can I then rout the controllers in another project with umbraco?
Ensure your controller project .dll is in the umbraco /bin folder (using a post-build copy). Umbraco should then automatically pick it up, if it's an umbraco SurfaceController.
e.g assuming your solution has two projects:
Ideally you should set this up to be automated - if you're unsure about setting up a post build copy, let me know :)
is working on a reply...