Hacking Sitecore and Life one pipeline at a time!

Dynamic Sites Manager 1.9.1 – Update


In true Sitecore fashion, I wanted to quickly get an initial working version of Dynamic Sites Manager out the door for the Sitecore 8.2 Initial Release.  Tonight, I went back into the code and realized that the SiteManager.Providers property has been marked obsolete, something that wasn’t very clear in the Release Notes. This means at some point in a later release, SiteManager.Providers will become a breaking change.

As such, I wanted to go ahead and clean that up.  Instead of using this property, I am now calling the service using dependency injection. Originally, I wasn’t using a constructor for my SwitcherSiteProvider class, but now I am.

 private readonly ProviderHelper<SiteProvider, SiteProviderCollection> _providerHelper;

public SwitcherSiteProvider(ProviderHelper<SiteProvider, SiteProviderCollection> providerHelper)
_providerHelper = providerHelper;

However, there’s one more step that I have to take.  I have to tell Sitecore’s Configuration Factory that it needs to resolve this class for dependency.

      <patch:attribute name="defaultProvider">switcher</patch:attribute>
        <add name="dynamic" type="Sitecore.SharedSource.DynamicSites.Sites.DynamicSitesProvider, SharedSource.Sitecore.DynamicSites" siteConfig="dynamicsites" checkSecurity="false" />
        <add name="switcher" type="Sitecore.SharedSource.DynamicSites.Sites.SwitcherSiteProvider, SharedSource.Sitecore.DynamicSites" checkSecurity="false" resolve="true" />

The magic is in the addition of the resolve=”true” attribute on my provider.

Time to use the hell out of the built in dependency injection with Sitecore 8.2!

Get Dynamic Sites Now

Tagged as: , ,

Categorised in: Sitecore, Technology, Uncategorized

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 1,238 other subscribers

Blog Stats

  • 132,847 hits
Follow Sitecore Hacker on WordPress.com
Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S in the U.S. and other countries.  This website is independent of Sitecore Corporation, and is not affiliated with or sponsored by Sitecore Corporation.
%d bloggers like this: