Copied to clipboard

Flag this post as spam?

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

  • rubenberendsen 13 posts 106 karma points
    May 06, 2021 @ 06:50

    Best practice for modelsbuilder

    Hi all,

    In Umbraco 8.1 i had a project with the models builder mode DLL (modelsbuilder version 8.1.0). But i have updated to Umbraco 8.13 en Umbraco.Modelsbuilder to 8.1.6.

    Now i see in the documentary that 'DLL' mode is not supported anymore.

    We had a separate class libary for the models: We had a separate class libary for the models:

    Now i have changed the app settings in the web.config to this: App settings in web.config

    And i have changed to web.release.config to this: app settings release

    But i don't know if this is the best way to do this. I think the seperate class library is now (without DLL) outdated.

    Can anyone tell me what is the best practice to develop on my local machine and then release it to the production environment?

  • Brendan Rice 501 posts 915 karma points
    May 06, 2021 @ 13:09
    Brendan Rice

    Hi Ruben,

    as you've found out Umbraco stopped supporting DLL mode and building to a different directory from App_Data. I'm not sure if the app settings are still officially supported by Umbraco.

    Stephen (who wrote the original Model builder) has a separate branch if you need the DLL mode but it doesn't seem to be actively under development and isn't being maintained by the Umbraco team, which is personally put me off using it.

    I typically use AppData or AppDataLive, you lose the ability for sharing models code in different projects.

  • Patrick van Kemenade 97 posts 325 karma points
    May 07, 2021 @ 17:42
    Patrick van Kemenade

    Don't think AppDataLive exists it's LiveAppData

  • rubenberendsen 13 posts 106 karma points
    May 07, 2021 @ 06:38

    Hi Brendan,

    Thanks for your reply.

    I will test my project with AppData (local) and AppDataLive (production) en remove my class library project.

  • Erik Eelman 79 posts 313 karma points
    May 07, 2021 @ 08:19
    Erik Eelman

    Hi Ruben,

    In our projects we use the Visual studio Umbraco ModelsBuilder Extension and use the modelsbuilder API.

    enter image description here enter image description here

  • rubenberendsen 13 posts 106 karma points
    May 07, 2021 @ 08:33

    We are using CustomControllers in our project. That is the reason why we chosen the DLL mode.

    Dus anyone know how to use CustomControllers with AppData or is modelsbuilders API the best solution for this?

  • Patrick van Kemenade 97 posts 325 karma points
    May 07, 2021 @ 17:38
    Patrick van Kemenade

    I'm using LiveAppData.

    Umbraco 8.13 (think from 8.6 onwards) has a modelbuilder is builtin in Umbraco so no need for another builder. Think you need to deactivate the old ModelsBuilder you still needed in 8.1 for this to become active though (please backup before doing this).

    I have a seperate class library with has references to Umbraco.Cms.Core + Umbraco.Cms.Web so I can use needed Umbraco commands in my custom controllers and extensions and I call this class library SiteExtension.

    In the web.config section appSettings you need to specify the location where Umbraco needs to store the generated class files for the document types. In my setup / namespace this is:

    <add key="Umbraco.ModelsBuilder.Enable" value="true" />
    <add key="Umbraco.ModelsBuilder.ModelsMode" value="LiveAppData" /> <!-- LiveAppData-->
    <add key="Umbraco.ModelsBuilder.ModelsNamespace" value="SiteExtension.Core.DocumentTypes" />
    <add key="Umbraco.ModelsBuilder.ModelsDirectory" value="~/../SiteExtension.Core/DocumentTypes" />
Please Sign in or register to post replies

Write your reply to: