예제 #1
0
        /// <summary>
        /// Handles an incoming <see cref="Request"/>.
        /// </summary>
        /// <param name="nancyEngine">The <see cref="INancyEngine"/> instance.</param>
        /// <param name="request">An <see cref="Request"/> instance, containing the information about the current request.</param>
        /// <param name="preRequest">Delegate to call before the request is processed</param>
        /// <returns>A <see cref="NancyContext"/> instance containing the request/response context.</returns>
        public static NancyContext HandleRequest(this INancyEngine nancyEngine, Request request, Func <NancyContext, NancyContext> preRequest)
        {
            var task = nancyEngine.HandleRequest(request, preRequest, CancellationToken.None);

            try
            {
                task.Wait();
            }
            catch (Exception ex)
            {
                var flattenedException = NancyEngine.FlattenException(ex);
                throw flattenedException;
            }
            return(task.Result);
        }
예제 #2
0
 public NancyWcfGenericService(Assembly modulesAssembly)
 {
     this.engine = new NancyEngine(new NancyModuleLocator(modulesAssembly), new RouteResolver());
 }