Copied to clipboard

Flag this post as spam?

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


  • Poornima Nayar 106 posts 276 karma points MVP 6x c-trib
    Dec 11, 2016 @ 20:35
    Poornima Nayar
    0

    Umbraco Performance

    I have a class in which I need to create an instance of ContentService. Following on from following on from https://our.umbraco.org/Documentation/Reference/Common-Pitfalls/ is it advisable to create the ApplicationContext.Current.Services.ContentService as a static instance. I am not getting something right I believe.

    Poornima

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Dec 11, 2016 @ 23:09
    Alex Skrypnyk
    0

    Hi Poornima,

    Do not create static instances of ContentService.

    Use created one - ApplicationContext.Current.Services.ContentService

    Can you provide code of your classes, we can look at and find something together.

    Thanks,

    Alex

  • Poornima Nayar 106 posts 276 karma points MVP 6x c-trib
    Dec 11, 2016 @ 23:17
    Poornima Nayar
    0

    I found this in code I inherited. I have always stuck to using the Services property in SurfaceControllers or invoking it off ApplicationContext. I read Shannon's post and thought the line of code would lead to miserable issues in the long run but just wanted some community opinion. Many thanks Alex

    Poornima

Please Sign in or register to post replies

Write your reply to:

Draft