Copied to clipboard

Flag this post as spam?

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


  • Perry Cope 31 posts 195 karma points
    Mar 30, 2020 @ 14:37
    Perry Cope
    0

    ModelsBuilder First run visual studio

    How Do i generate Models For Models Builder if i can not build the site due to Models being referenced in code such as controllers and Helpers (.cs files)?

  • Julien Kulker 75 posts 427 karma points c-trib
    Mar 31, 2020 @ 06:47
    Julien Kulker
    0

    If you have the website running you can change the config using LiveAppData. This way you can generate the models trough umbraco.

    Default the models will be saved .

    ~/App_Data/Models

    https://our.umbraco.com/documentation/reference/templating/modelsbuilder/Builder-Modes

    <add key="Umbraco.ModelsBuilder.Enable" value="true" />
    <add key="Umbraco.ModelsBuilder.ModelsMode" value="LiveAppData" />
    <add key="Umbraco.ModelsBuilder.ModelsDirectory" value="~/App_data/Models" />
    <add key="Umbraco.ModelsBuilder.AcceptUnsafeModelsDirectory" value="true" />
    <add key="Umbraco.ModelsBuilder.ModelsNamespace" value="" />
    
  • Perry Cope 31 posts 195 karma points
    Mar 31, 2020 @ 09:51
    Perry Cope
    0

    The website is not running anywhere and can not be run until i have the models. i seem to have to in to this situation converting from LiveDLL that seems to be deprecated too LiveAppData.

    As such there is nothing in My App_data/Models folder and no DLL built. so my code will never compile now. and i don't know how to hit the database to generate the models without the code running.

  • Julien Kulker 75 posts 427 karma points c-trib
    Mar 31, 2020 @ 10:16
    Julien Kulker
    100

    You can setup a new umbraco website. Then couple the database that you already have. Changing the connection string. Then create models with LiveAppData.

    That should work:

    step 1: Install Clean Umbraco step 2: Change connection string to database with the models and stuff. step 3: Regenerate models.

  • Perry Cope 31 posts 195 karma points
    Mar 31, 2020 @ 10:22
    Perry Cope
    0

    Didn't think of that makes sense if not a bit cumbersome. I guess a project without its models wouldn't work regardless of whether it was Umbraco or not. its just a confusing way to work having the models generated through the db.

    Especially when it defaults in the App_Data which we usually don't commit

  • Julien Kulker 75 posts 427 karma points c-trib
    Mar 31, 2020 @ 11:40
    Julien Kulker
    0

    Let me know if you get it to work:)

  • Perry Cope 31 posts 195 karma points
    Mar 31, 2020 @ 11:52
    Perry Cope
    0

    I believe it will work.

    After thinking about it my problem stems from the fact im working with 2 Databases that connect to the same Umbraco Code.

    Database A is an upgrade of B with altered Document and DataTypes, when i Connect to Database B Umbraco Generated Models will no longer match the code base. Im pretty sure in that case my solution is to change from LiveAppData too AppData so i dont overwrite the working models for the code until i migrate the Umbraco Document and DataTypes in B to match A.

Please Sign in or register to post replies

Write your reply to:

Draft