public class SwitchingLinkProvider : LinkProvider
    {
        private const string FallbackAttributeKey = "fallback";
        private const string LinkproviderAttributeKey = "linkProvider";
        private readonlyLinkProviderCollection _providers = new ProviderHelper<LinkProvider,LinkProviderCollection>("linkManager").Providers;

        public override bool AddAspxExtension
        {
            get
            {
                return SiteLinkProvider.AddAspxExtension;
            }
        }

        public override bool AlwaysIncludeServerUrl
        {
            get
            {
                return SiteLinkProvider.AlwaysIncludeServerUrl;
            }
        }

        public override bool EncodeNames
        {
            get
            {
                return SiteLinkProvider.EncodeNames;
            }
        }

        public override LanguageEmbedding LanguageEmbedding
        {
            get
            {
                return SiteLinkProvider.LanguageEmbedding;
            }
        }

        public override LanguageLocation LanguageLocation
        {
            get
            {
                return SiteLinkProvider.LanguageLocation;
            }
        }

        public override bool LowercaseUrls
        {
            get
            {
                return SiteLinkProvider.LowercaseUrls;
            }
        }

        public override bool ShortenUrls
        {
            get
            {
                return SiteLinkProvider.ShortenUrls;
            }
        }

        public override bool UseDisplayName
        {
            get
            {
                return SiteLinkProvider.UseDisplayName;
            }
        }

        private string Fallback { get; set; }
        
        private LinkProvider SiteLinkProvider
        {
            get
            {
                var siteLinkProvider = (Sitecore.Context.Site != null)
                    ? Sitecore.Context.Site.Properties[LinkproviderAttributeKey] : string.Empty;

                if (string.IsNullOrEmpty(siteLinkProvider))
                {
                    siteLinkProvider = this.Fallback;
                }

                return _providers[siteLinkProvider]
                       ?? _providers[this.Fallback];
            }
        }
        public override string ExpandDynamicLinks(string text, bool resolveSites)
        {
            return SiteLinkProvider.ExpandDynamicLinks(text, resolveSites);
        }

        public override UrlOptions GetDefaultUrlOptions()
        {
            return SiteLinkProvider.GetDefaultUrlOptions();
        }

        public override string GetItemUrl(Item item, UrlOptions options)
        {
            return SiteLinkProvider.GetItemUrl(item, options);
        }

        public override string GetDynamicUrl(Item item, LinkUrlOptions options)
        {
            return SiteLinkProvider.GetDynamicUrl(item, options);
        }

        public override bool IsDynamicLink(string linkText)
        {
            return SiteLinkProvider.IsDynamicLink(linkText);
        }

        public override DynamicLink ParseDynamicLink(string linkText)
        {
            return SiteLinkProvider.ParseDynamicLink(linkText);
        }

        public override RequestUrl ParseRequestUrl(HttpRequest request)
        {
            return SiteLinkProvider.ParseRequestUrl(request);
        }

        public override void Initialize(string name, NameValueCollection config)
        {
            base.Initialize(name, config);
            this.Fallback = config[FallbackAttributeKey];
            Assert.IsNotNullOrEmpty(this.Fallback, "fallback");
        }
    }