Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
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.
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.
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
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted