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 16 posts 177 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 16 posts 177 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