コード例 #1
0
        /// <summary>
        /// Gets the first plugin section.
        /// </summary>
        /// <typeparam name="TSection">The type of the section.</typeparam>
        /// <param name="manager">The manager.</param>
        /// <param name="sectionName">Name of the section.</param>
        /// <returns></returns>
        public static TSection GetFirstPluginSection <TSection>(this DeepConfigManager manager, string sectionName)
            where TSection : ConfigurationSection
        {
            var settings = PluginManagerConfiguration.GetSettings();

            return(manager.GetFirstWebSetting <TSection, TSection>(sectionName, x => x, settings.PluginsPath));
        }
コード例 #2
0
        /// <summary>
        /// Gets the first configuration setting matching <paramref name="sectionName"/> by calling <see cref="DeepConfigManager.GetWebSettings{TSection,TOut}(string,Func{TSection,TOut},string,string,string)"/>.
        /// See that method for an example. The relative plugin base path in <see cref="PluginManagerConfiguration.PluginsPath"/> is mapped to a physical path using the <see cref="System.Web.HttpContextWrapper"/> supplied to this instance
        /// <paramref name="manager"/> in its constructor.
        /// </summary>
        /// <typeparam name="TSection">The type of the section.</typeparam>
        /// <typeparam name="TOut">The type outputted by the expression in <paramref name="deferred"/>.</typeparam>
        /// <param name="manager">The manager.</param>
        /// <param name="sectionName">Name of the section in the configuration files.</param>
        /// <param name="deferred">The deffered expression.</param>
        /// <returns></returns>
        public static TOut GetFirstPluginSetting <TSection, TOut>(this DeepConfigManager manager, string sectionName, Expression <Func <TSection, TOut> > deferred)
            where TSection : ConfigurationSection
            where TOut : class
        {
            var settings = PluginManagerConfiguration.GetSettings();

            return(manager.GetFirstWebSetting(sectionName, deferred, settings.PluginsPath));
        }
コード例 #3
0
        /// <summary>
        /// Gets the plugin settings.
        /// </summary>
        /// <typeparam name="TSection">The type of the section.</typeparam>
        /// <typeparam name="TOut">The type of the out.</typeparam>
        /// <param name="manager">The manager.</param>
        /// <param name="sectionName">Name of the section.</param>
        /// <param name="deferred">The deferred.</param>
        /// <returns></returns>
        public static IEnumerable <TOut> GetPluginSettings <TSection, TOut>(this DeepConfigManager manager, string sectionName, Expression <Func <TSection, TOut> > deferred)
            where TSection : ConfigurationSection
            where TOut : class
        {
            var settings       = PluginManagerConfiguration.GetSettings();
            var pluginBasePath = settings != null ? settings.PluginsPath : "~/Config/";

            return(manager.GetWebSettings(sectionName, deferred, pluginBasePath));
        }
コード例 #4
0
        public void InitialiseWithCustomILogger()
        {
            TestLogger testLogger = new TestLogger();
            PluginManagerConfiguration configuration = new PluginManagerConfiguration(testLogger);

            PluginManagerService.Initialise(configuration);

            ILogger pluginManagerLogger = PluginManagerService.GetLogger();

            Assert.AreNotEqual(pluginManagerLogger.GetType().TypeHandle.Value, testLogger.GetType().TypeHandle.Value);
        }
コード例 #5
0
        public static void Main(string[] args)
        {
            // add plugins which need to be loaded first
            PluginManagerService.UsePlugin(typeof(ErrorManager.Plugin.PluginInitialisation));
            PluginManagerService.UsePlugin(typeof(BadEgg.Plugin.PluginInitialisation));
            PluginManagerService.UsePlugin(typeof(RestrictIp.Plugin.PluginInitialisation));
            PluginManagerService.UsePlugin(typeof(UserSessionMiddleware.Plugin.PluginInitialisation));
            PluginManagerService.UsePlugin(typeof(CacheControl.Plugin.PluginInitialisation));
            PluginManagerService.UsePlugin(typeof(MemoryCache.Plugin.PluginInitialisation));
            PluginManagerService.UsePlugin(typeof(Spider.Plugin.PluginInitialisation));
            PluginManagerService.UsePlugin(typeof(SeoPlugin.PluginInitialisation));
            PluginManagerService.UsePlugin(typeof(Localization.Plugin.PluginInitialisation));
            PluginManagerService.UsePlugin(typeof(Breadcrumb.Plugin.PluginInitialisation));
            PluginManagerService.UsePlugin(typeof(WebSmokeTest.Plugin.PluginInitialisation));
            PluginManagerService.UsePlugin(typeof(GeoIp.Plugin.PluginInitialisation));

            PluginManagerConfiguration configuration = new PluginManagerConfiguration();

            configuration.ServiceConfigurator = new ServiceConfigurator();

            // Initialise the plugin manager service
            PluginManagerService.Initialise(configuration);
            try
            {
                // Add generic plugins where load order does not matter
                PluginManagerService.UsePlugin(typeof(DocumentationPlugin.PluginInitialisation));
                PluginManagerService.UsePlugin(typeof(ProductPlugin.PluginInitialisation));
                PluginManagerService.UsePlugin(typeof(ShoppingCartPlugin.PluginInitialisation));
                PluginManagerService.UsePlugin(typeof(HelpdeskPlugin.PluginInitialisation));
                PluginManagerService.UsePlugin(typeof(UserAccount.Plugin.PluginInitialisation));
                PluginManagerService.UsePlugin(typeof(LoginPlugin.PluginInitialisation));
                PluginManagerService.UsePlugin(typeof(Sitemap.Plugin.PluginInitialisation));
                PluginManagerService.UsePlugin(typeof(SystemAdmin.Plugin.PluginInitialisation));
                PluginManagerService.UsePlugin(typeof(DownloadPlugin.PluginInitialisation));
                PluginManagerService.UsePlugin(typeof(Company.Plugin.PluginInitialisation));
                PluginManagerService.UsePlugin(typeof(Blog.Plugin.PluginInitialisation));
                PluginManagerService.UsePlugin(typeof(DemoWebsitePlugin.Plugin.PluginInitialisation));
                PluginManagerService.UsePlugin(typeof(DemoApiPlugin.PluginInitialisation));

                CreateWebHostBuilder(args).Build().Run();
            }
            finally
            {
                PluginManagerService.Finalise();
            }
        }
コード例 #6
0
        /// <summary>
        /// Returns a collection of all connection string registered via deep config
        /// </summary>
        /// <param name="manager"></param>
        /// <returns></returns>
        public static IEnumerable <ConnectionStringSettings> GetConnectionStrings(this DeepConfigManager manager)
        {
            var settings = PluginManagerConfiguration.GetSettings();

            return(manager.GetConnectionStrings(settings.PluginsPath));
        }
コード例 #7
0
 static UnitTestHelper()
 {
     PluginManagerConfiguration configuration = new PluginManagerConfiguration();
     //PluginSettings settings = null;
 }