Copied to clipboard

Flag this post as spam?

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


  • René Pjengaard 117 posts 700 karma points c-trib
    Jul 10, 2017 @ 20:21
    René Pjengaard
    0

    Modelsbuilder in UmbracoApiController?

    Hi there,

    anyone know if it is possible to use Modelsbuilder with the UmbracoApiController? And if so, how to do it? I can´t seem to gain access to the models.

    Best regards René

  • Damiaan 442 posts 1301 karma points MVP 6x c-trib
    Jul 10, 2017 @ 20:23
    Damiaan
    0

    Yes you are. How are you using the models? I mean, Dll, App_Data, ... ?

  • René Pjengaard 117 posts 700 karma points c-trib
    Jul 10, 2017 @ 20:30
    René Pjengaard
    0

    Hi mr. Magician,

    i´m using them in dll in development and PureLive in live.

    /R

  • Damiaan 442 posts 1301 karma points MVP 6x c-trib
    Jul 10, 2017 @ 20:37
    Damiaan
    101

    There you have the issue. PureLive the models are generated in a dynamic in-memory assembly. That means you won't be able to compile any C# code using them. Because it does not exist at compile time. If you use any of the other modes, the models will be build and can be available in your solution.

    • With App_Data mode, I always put it in an other folder and then include them in the product.
    • If you use Dll, you need to reference the DLL in your solution.

    Doing so will allow you to use the models in your (Api)Controllers.

    Kind regards
    Damiaan

  • René Pjengaard 117 posts 700 karma points c-trib
    Jul 10, 2017 @ 20:53
    René Pjengaard
    0

    Hi Damiaan,

    thanks for solving this mystery for me :-).

    Best regards René

  • Damiaan 442 posts 1301 karma points MVP 6x c-trib
    Jul 10, 2017 @ 20:55
    Damiaan
    1

    Glad I could help. :-)

    The only thing which I need to do now, is to practice some magic... And submit a proposal talk for next year... ;-)

Please Sign in or register to post replies

Write your reply to:

Draft