public void AddAsyncHandler(IUriRoute route, Func<DataBatch, TcpResponse, Task<bool>> handler)
        {
            _routes.AddHandler(route, (p, c) =>
            {
                var doc = c["ext.DataBatch"] as DataBatch;

                foreach (var parameter in p)
                {
                    doc.Properties[parameter.Key.ToLower()] = parameter.Value;
                }

                return handler(doc, c.Response);
            });
        }
Example #2
0
        public void AddRoute(IUriRoute route, Func<IOwinContext, Task> handler)
        {
            _routes.AddHandler(route, async (r, c) =>
            {
                foreach (var v in r)
                {
                    c["route." + v.Key] = v.Value;
                }

                await handler(c);

                return true;
            });
        }
 public void AddHandler(IUriRoute route, Func<DataBatch, TcpResponse, bool> handler)
 {
     AddAsyncHandler(route, (b, r) => Task.FromResult(handler(b, r)));
 }