Copied to clipboard

Flag this post as spam?

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


  • Rob de Mercado 32 posts 148 karma points
    Mar 13, 2019 @ 10:04
    Rob de Mercado
    0

    Upgrading code files from U7 to U8

    Upgrading code files from U7 to U8. The following line of code now throws error CS0103: The name 'ApplicationContext' does not exist in the current context.

    using Umbraco.Core;
    var db = ApplicationContext.Current.DatabaseContext.Database;
    

    Please advise.

  • Henrik Vincent 122 posts 616 karma points
    Mar 13, 2019 @ 10:28
    Henrik Vincent
    0

    Hi Rob

    Try var db = DatabaseContext.Database; instead

  • Sebastiaan Janssen 5061 posts 15544 karma points MVP admin hq
    Mar 13, 2019 @ 10:33
    Sebastiaan Janssen
    101

    @Henrik That doesn't exist like that in v8 either ;-)

    @Rob see my answer here: https://our.umbraco.com/forum/umbraco-8/96175-cant-find-applicationcontext#comment-304141

  • Henrik Vincent 122 posts 616 karma points
    Mar 13, 2019 @ 10:35
    Henrik Vincent
    0

    Alrighty. Was worth a try :)

    Had the same issue, but with ApplicationContext.Current.Services.RelationService; and it working for me removingApplicationContext.Current.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies