Copied to clipboard

Flag this post as spam?

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


  • Ask 13 posts 83 karma points
    Sep 12, 2022 @ 13:36
    Ask
    0

    starter kit page is in 'InMemoryAuto' mode, I cannot change it to 'SourceCodeManual'

    Hi I've been following the guide in this video series, which is quite good. It basically involves setting up a project with the umbraco starter kit, and then having a bit of a walkthrough of how the models inside the cms maps to the models of the asp.net solution.

    But when I go into settings> models builder I see this:

    ModelsBuilder is enabled, with the following configuration:
    The models mode is 'InMemoryAuto'. Strongl ...
    

    ok, So I just need to find out how to disable this mode. I find this article. Seems simple enough, just edit the appsettings.json file.

    So I add this to appsettings.json:

      "ModelsBuilder": {
        "ModelsMode": "SourceCodeManual",
        "ModelsNamespace": "Umbraco.Cms.Web.Common.PublishedModels",
        "FlagOutOfDateModels": false,
        "ModelsDirectory": "~/umbraco/models",
        "AcceptUnsafeModelsDirectory": false,
        "DebugLevel": 0
      },
    

    And then I try to run again. which gives me this error:

    The type or namespace name 'Home' could not be found (are you missing a using directive or an assembly reference?)
    
            public class Views_home : Umbraco.Cms.Web.Common.Views.UmbracoViewPage<Home>
    

    Which makes sense, because it is looking for .cs files that are not there.

    How do I get out of this catch-22? and actually get some models that I can look at?

  • Corné Hoskam 81 posts 588 karma points MVP 3x c-trib
    Sep 12, 2022 @ 18:03
    Corné Hoskam
    1

    Hi Ask,

    My recommendation would be to comment our any references that you may have in your code to anything related to the InMemoryAuto mode (In this case, the Home doctype), so that you can safely build and run your application, in order to then run the ModelsBuilder from within the backoffice in SourceCodeManual mode!

    Kind regards,

    Corné

  • Ask 13 posts 83 karma points
    Sep 12, 2022 @ 19:38
    Ask
    0

    Hmm, I feel that this leaves me in a chickednor the egg situation.

    I want to use the starter kit template. I can't build the project unless I remove basically all the code in the razor pages related to the starter kit.

    I could just remove all the starter kit code, but then I would not have the starter kit, which is what I want

    I now tried it out. Pretty much deleting everything in the generated views, running the application in SourceCodeManual mode.

    I could then generate the models from the backoffice.

    I then tried shutting the application down again, and pasting the deleted stuff into the views again.

    This now fails because it does not have access to the same models:

    RuntimeBinderException: 'Umbraco.Cms.Core.Models.ContentModel' does not contain a definition for 'HeroBackgroundImage'

    So, the generated models do not seem to the replacealbe with the ones from Inmemorymode. Also they have completely different names.

    Is this the intended usage of the starter kit? or how is it supposed to work?

Please Sign in or register to post replies

Write your reply to:

Draft