Copied to clipboard

Flag this post as spam?

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


  • Carl Sjöholm 44 posts 327 karma points
    Jun 11, 2019 @ 06:22
    Carl Sjöholm
    0

    Umbraco in static class

    Hi.

    There has been a lot of topics for Umbraco in custom classes and I can't figure out the correct way to implement a static class (for extensions).

    public static class CompositionExtensions
    {
        private static readonly IUmbracoContextFactory _context;
    
        public static void SetUmbracoRoutes(this Composition composition)
        {
            var rootNodes = _context.EnsureUmbracoContext().UmbracoContext.ContentCache.GetByXPath("root/");
    

    I saw some link to Lazy<> and LazyInitializer but did not get the context of how to actually implement it.

    Any help would be great!

  • Carl Sjöholm 44 posts 327 karma points
    Jun 12, 2019 @ 05:39
    Carl Sjöholm
    100

    Found another solution by using IComponent

Please Sign in or register to post replies

Write your reply to:

Draft