예제 #1
0
        /// <summary>
        /// Set return by <para>wrapFunc</para> AppRunner to <para>appConfig</para> using AppRunner predefined key
        /// <para>wrapFunc</para> has single parameter - current AppRunner (could be null)
        /// </summary>
        /// <param name="appConfig">AppConfig instance</param>
        /// <param name="wrapFunc">WrapFunc delegate</param>
        /// <returns>AppConfig instance passed to the method</returns>
        public static IAppConfig WrapAppRunner(this IAppConfig appConfig, Func <Action, Action> wrapFunc)
        {
            if (appConfig == null)
            {
                throw new ArgumentNullException(nameof(appConfig));
            }
            if (wrapFunc == null)
            {
                throw new ArgumentNullException(nameof(wrapFunc));
            }

            appConfig.SetAppRunner(wrapFunc(appConfig.GetAppRunner()));
            return(appConfig);
        }