Copied to clipboard

Flag this post as spam?

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


  • Ashkan Sirous 38 posts 232 karma points
    Aug 11, 2017 @ 09:30
    Ashkan Sirous
    0

    EF code first with the cloud solution

    Hi,

    It is my first Umbraco Cloud solution and apparently I am facing problems everyday :)

    I like to have some user specific data separated from the Umbraco and therefore I like to have them on a separated database on Azure.

    To do so, I've created my models and context on the core project, then on package manager console I've selected my core project and wrote "Enable-Migrations" .

    Then an error came up saying The project 'xxx.Web' failed to build.

    And on the "Error List" pan I can see some build errors related to Umbraco folder, like:

    Error CS1061 'IPublishedContent' does not contain a definition for 'Ancestors' and no extension method 'Ancestors' accepting a first argument of type 'IPublishedContent' could be found (are you missing a using directive or an assembly reference?) 2UmbracoPartialViewMacrosTemplatesBreadcrumb.cshtml

    What is the solution? Am I following the right approach?

  • Ashkan Sirous 38 posts 232 karma points
    Aug 14, 2017 @ 21:01
    Ashkan Sirous
    0

    Has anyone solved the problem? How would you connect to an external DB while you are working with UaaS?! Is it impossible?!

  • Nik 1614 posts 7260 karma points MVP 7x c-trib
    Aug 14, 2017 @ 21:42
    Nik
    0

    Hi Ashkan,

    I've not tried it myself, but I believe you would need an externally hosted database. I don't believe it is possible to add another database into the Umbraco Cloud instance, however you could try asking Umbraco Support via your cloud portal. They might be able to give you some pointers?

    Nik

  • Ashkan Sirous 38 posts 232 karma points
    Aug 14, 2017 @ 21:48
    Ashkan Sirous
    0

    Hi Nik, I have my database in Azure and I can connect to it with a normal .net project. The problem is that the UaaS generated code has compile errors that prevents EF- code first from generating migrations 😐😞

  • Nik 1614 posts 7260 karma points MVP 7x c-trib
    Aug 14, 2017 @ 21:50
    Nik
    0

    Hi Ashkan,

    Have you added a reference to Entity Framework to the Web project? Because the Core project requires it, you'll probably need to add it to the Web one as well.

    Do you have a full list of all of the errors you are getting? It can be a case that some of the errors are "false" errors.

  • Ashkan Sirous 38 posts 232 karma points
    Aug 15, 2017 @ 07:30
    Ashkan Sirous
    0

    Nik, I've checked it. It simply doesn't work. :(

  • Ashkan Sirous 38 posts 232 karma points
    Aug 14, 2017 @ 22:00
    Ashkan Sirous
    0

    Hmm. I've just added it to coreπŸ€”. My errors are Umbraco views (not mine πŸ˜€ ) that live under folders other than view, so they don't understand normal web.config namespaces. So it doesn't recognize Image as a type, or some extention methods for IPublishedContent. I will try adding EF to web the first thing in the morning

  • Nik 1614 posts 7260 karma points MVP 7x c-trib
    Aug 15, 2017 @ 08:12
    Nik
    0

    Hi Ashkan,

    When you say they are "umbraco views" where exactly are these views? Are they located under the Views folder?

    Looking at your error message it looks like they are located under Views -> MacroPartials is that correct?

    You mention this is an Umbraco Cloud project, does the version in the cloud work at the moment? If so, it might be easier to re-clone the web project and see if that resolves the issue?

Please Sign in or register to post replies

Write your reply to:

Draft