Copied to clipboard

Flag this post as spam?

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


  • Matteo 1 post 71 karma points
    Jul 27, 2022 @ 14:10
    Matteo
    0

    DB tables and some controllers excluded from Umbraco

    Hello everybody,

    I am an IT contact for my company and we are at the first experience with Umbraco!

    We are developing a "monolith" application using Umbraco.CMS installed (v10.0.1 - .net6 framework). We wanted to know if within the same monolith with Umbraco installed we can have and work on extra custom DB tables managed by the application compared to those created by Umbraco and if we can have Controllers (mainly API Controllers but possibly also MVC) where we can work these tables keeping everything out from the "control" of Umbraco in a transparent way or we have to do some kind of particular configuration?

    thank you so much,

    Matteo

  • Marc Goodson 2141 posts 14344 karma points MVP 8x c-trib
    Aug 14, 2022 @ 15:01
    Marc Goodson
    0

    Hi Matteo

    It's fine to have additional tables in the same database as the Umbraco onces, Umbraco won't freak if they exist!

    However there is a consideration, that if those tables are being updated by the 'front end' of your site, by users updating information, filling in forms etc, that it rather ties you to that database in any kind of Umbraco upgrade/migration scenario.

    For an Umbraco upgrade, there might be an update to the underlying Database structure, or you might need to migrate data to another format if an existing property editor isn't compatible... in those circumstances, it's useful to organise a 'content freeze' with the editors - take a copy of the db, apply your changes, migrate data etc, test everything, then switch the database back to be the production one.

    So if there are two or three updates to your custom tables every few minutes, then those updates would not make it into the upgraded database ... so it depends on how crucial that is.

    If I've got custom database tables that get updated a lot, I tend to put them in a separate database to provide that flexibility...

    But yes, once you have your tables, whether in a separate DB or not, you can have either API Controllers or MVC controllers that are in the same VS solution that are ignored by Umbraco, or, for the win, you can create these controllers as part of Umbraco and make the custom database content appear as 'Virtual content' within the site, eg use all the same Views as Umbraco does.

    Useful info here: https://our.umbraco.com/Documentation/Reference/Routing/Custom-Routes/

    and you'd ignore a folder using the Umbraco-Global-ReservedPaths in appsettings (a comma delimited list of folders to ignore)

     "Global": {
            "ReservedPaths": "~/some-path-here",
            "Id": "cf1744bf-0998-413d-8a97-7a704604e123"
          }
    

    regards

    Marc

Please Sign in or register to post replies

Write your reply to:

Draft