Exemplo n.º 1
0
        /// <summary>
        /// Add WebApiModule to WebServer
        /// </summary>
        /// <param name="webserver">The webserver instance.</param>
        /// <param name="assembly">The assembly to load WebApi Controllers from. Leave null to avoid autoloading.</param>
        /// <returns>The webserver instance.</returns>
        public static WebServer WithWebApi(this WebServer webserver, Assembly assembly = null)
        {
            if (webserver == null)
            {
                throw new ArgumentException(Constants.ArgumentNullExceptionMessage, nameof(webserver));
            }

            webserver.RegisterModule(new WebApiModule());
            return((assembly != null) ? webserver.LoadApiControllers(assembly) : webserver);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Add WebApiModule to WebServer
        /// </summary>
        /// <param name="webserver">The webserver instance.</param>
        /// <param name="assembly">The assembly to load WebApi Controllers from. Leave null to avoid autoloading.</param>
        /// <returns>The webserver instance.</returns>
        public static WebServer WithWebApi(this WebServer webserver, Assembly assembly = null)
        {
            if (webserver == null)
            {
                throw new ArgumentException("Argument cannot be null.", "webserver");
            }

            webserver.RegisterModule(new WebApiModule());
            return((assembly != null) ? webserver.LoadApiControllers(assembly) : webserver);
        }