Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Khashayar 2 posts 32 karma points
    Feb 05, 2013 @ 01:58
    Khashayar
    0

    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

  • Jade Montagu 8 posts 71 karma points
    Feb 05, 2013 @ 03:03
    Jade Montagu
    100

    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.

  • Khashayar 2 posts 32 karma points
    Feb 05, 2013 @ 03:08
    Khashayar
    0

    Hi Jade,

    Thanks for your reply, one more question:

    How can I then rout the controllers in another project with umbraco?

  • Jade Montagu 8 posts 71 karma points
    Feb 05, 2013 @ 03:44
    Jade Montagu
    0

    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 :)

Please Sign in or register to post replies

Write your reply to:

Draft