コード例 #1
0
        string GetViewPath(string path, ControllerContext controllerContext)
        {
            var clientUrlParameter = controllerContext.RouteData.Values["client"].ToString();
            var assemblyName       = UrlToAssemblyMapping.GetAssemblyByUrl(clientUrlParameter).GetName().Name;

            return(path.Replace("%1", Location + "/" + assemblyName + "/"));
        }
コード例 #2
0
        public static void Register()
        {
            var assemblies = MefAssemblyFetcher.Fetch().ToList();

            foreach (var assembly in assemblies)
            {
                //by convention, everything before dot will be client url parameter
                var clientUrlParameter = assembly.GetName().Name.Split('.').First();
                UrlToAssemblyMapping.Add(clientUrlParameter, assembly);
            }
            MefBootstrapper.Compose(assemblies);
            EmbeddedResourceRouteConfig.Register();
            ControllerBuilder.Current.SetControllerFactory(new MefFallbackControllerFactory());
            ViewEngines.Engines.Add(new SharedWebComponentsViewEngine("Plugins"));
            HostingEnvironment.RegisterVirtualPathProvider(new EmbeddedResourceVirtualPathProvider(new EmbeddedResourceNameResolver(assemblies)));
        }