Copied to clipboard

Flag this post as spam?

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


  • Mark Kneasel 22 posts 43 karma points
    Apr 10, 2014 @ 17:46
    Mark Kneasel
    0

    Reusable MVC Controls

    First I will start off by saying I am new to Umbraco and even newer to MVC (currently only use web forms). My company will have several Umbraco sites in the future of which some will share the same forms. So with that in mind what is the best way to have those forms in one project and then use them in each Umbraco site?

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Apr 10, 2014 @ 18:49
    Jan Skovgaard
    0

    Hi Mark and welcome to our :)

    How are the sites managed today? (Are they administered from one CMS instance, or does each site have it's own CMS?) and how big are they in terms of visits and pages on the site?

    I'll get into more details once I know more about your current setup.

    Cheers, Jan

  • Mark Kneasel 22 posts 43 karma points
    Apr 10, 2014 @ 18:54
    Mark Kneasel
    0

    The sites all reside in their own CMS instance. Right now they are in an old CMS. We are currently redoing them all in a responsive design with Umbraco as the new CMS. As far as visits, they are very seasonal. Higher visits in Spring and Summer due to content. The first site are doing is small probably less than 50 pages, but some of the other could have 1000 our more pages. The kind of things that are shared across sites now in user controls are contact forms, newsletter signup forms, a spreader setting form all with connections to custom databases. Let me know if you have any other questions. I think I have an OK grasp on Umbraco but MVC is a struggle now and then trying to create these reusable "controls" in MVC is stumping me.

    Thanks for your help

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Apr 10, 2014 @ 19:05
    Jan Skovgaard
    0

    Hi Mark

    Ok...the way I see it you could have more sites in one Umbraco instance or you could have multiple Umbraco instances.

    No matter what you choose to do I hope that you're using some kind of source/version control like git or hg/mercurial. If doing so then make your Umbraco base setup and keep stuff like navigation, forms etc. as partial view macroes etc. - When you need to setup a new site you can do a clone from your main repository and tweak things a design and behaviour and add custom stuff to those sites that need it.

    No matter if you choose to setup a new Umbraco instance for each site or decide to have one instance hosting all the sites you can share the forms by creating partial view macroes, which can be inserted in the rich text editor. That way you only need to modify one file, which can be used across many sites.

    If you have an Umbraco instance for each site then you'll need to copy the modified version of the file to each of the other instances that would need the same changes.

    If your design and document types of each site are quite similar to each other it will be a benefit to have the sites in one instance. If they differ in design and content needs then having multiple instances may be the better way to go even though you need to copy changes from one solution to the other solution. This can probably be handled pretty smart in either git or hg/mercurial I guess.

    I hope the above explanation makes sense - bottom line is, I guess you should simply create the forms as partial view macros.

    /Jan

  • Mark Kneasel 22 posts 43 karma points
    Apr 10, 2014 @ 19:59
    Mark Kneasel
    0

    Yea we will need to have multiple instances because of the document types being different etc.

    We are using a source control called Vault.

    I was thinking I would need to use the partial view macros. I guess my question now is would I need to copy the model, controller, and view to each project whenever it would be needed? Kind of like if I was using a UserControl and needing to copy the .ascx file and dll?

    Thanks again for all of your help. Walking through it with you is making sense.

    Thanks

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Apr 10, 2014 @ 21:31
    Jan Skovgaard
    0

    Hi Mark

    Well, if you make a base installation, which you copy from project to project then you can include all the forms you're gonna need so that you don't have to create them from time to time.

    But you will need to copy eventual changes that should reflect all from site to site.

    Also keep in mind that you can benefit from having your base install running CE SQL so it can be version controlled and when you start at new project you can start by migrating from CE SQL to MSSQL for instance.

    I hope this answers your question :)

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft