Exemplo n.º 1
0
        static PluginLoaderEntryPoint()
        {
            //determinar probingPath

            var privatePath = "~/_plugins";

            try
            {
                var configFile = XElement.Load(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile);

                var probingElement = configFile.Descendants("runtime")
                    .SelectMany(runtime => runtime.Elements(XName.Get("probing")))
                    .FirstOrDefault();

                if (probingElement != null)
                {
                    var paths = probingElement.Attribute("privatePath").Value; //pode conter vários paths, separados por ';'
                    Trace.TraceInformation("[PluginLoader]:Private Path is '{0}'", paths);
                    privatePath = paths.Split(';')[0];
                }
            }
            catch (Exception ex)
            {
                Trace.TraceInformation("Error reading probing privatePath in web.config. {0}", ex.Message);
            }

            PluginFolder = new DirectoryInfo(HostingEnvironment.MapPath(privatePath));

            if (!PluginFolder.Exists)
            {
                PluginFolder.Create();
            }

            Storage = new PluginStorage(PluginFolder);
        }
        static PluginLoaderEntryPoint()
        {
            //determinar probingPath

            var privatePath = "~/_plugins";

            try
            {
                var configFile = XElement.Load(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile);

                var probingElement = configFile.Descendants("runtime")
                                     .SelectMany(runtime => runtime.Elements(XName.Get("probing")))
                                     .FirstOrDefault();

                if (probingElement != null)
                {
                    var paths = probingElement.Attribute("privatePath").Value; //pode conter vários paths, separados por ';'
                    Trace.TraceInformation("Private Path is '{0}'", paths);
                    privatePath = paths.Split(';')[0];
                }
            }
            catch (Exception ex)
            {
                Trace.TraceInformation("Error reading probing privatePath in web.config. {0}", ex.Message);
            }


            PluginFolder = new DirectoryInfo(HostingEnvironment.MapPath(privatePath));

            if (!PluginFolder.Exists)
            {
                PluginFolder.Create();
            }

            Storage = new PluginStorage(PluginFolder);
        }