Esempio n. 1
0
 public AggregatedRoute()
 {
     RequestMethods = new List<string>();
     Handlers = new LiaraMessageHandlerCollection();
     Conditions = new List<Func<LiaraContext, bool>>();
     RouteItems = new Dictionary<string, object>();
 }
Esempio n. 2
0
 public AggregatedRoute()
 {
     RequestMethods = new List <string>();
     Handlers       = new LiaraMessageHandlerCollection();
     Conditions     = new List <Func <LiaraContext, bool> >();
     RouteItems     = new Dictionary <string, object>();
 }
Esempio n. 3
0
        public LiaraMessageHandlerCollection GetRouteHandlerCollection(MethodInfo method)
        {
            var routeHandlers = new LiaraMessageHandlerCollection();

            dynamic declaringType = method;

            if (declaringType != null)
            {
                var modulesInScope = explorer.GetLiaraModules();
                var allowAnonymous = false;
                do
                {
                    object[] handlers = declaringType.GetCustomAttributes(typeof(LiaraMessageHandler), false);
                    if (handlers.Length <= 0)
                    {
                        continue;
                    }

                    foreach (
                        LiaraMessageHandler handler in handlers.OrderByDescending(h => ((LiaraMessageHandler)h).Order))
                    {
                        var type = handler.GetType();
                        if (allowAnonymous)
                        {
                            if (type == typeof(Authorize))
                            {
                                continue;
                            }
                        }
                        if (type == typeof(AllowAnonymous))
                        {
                            allowAnonymous = true;
                            continue;
                        }
                        routeHandlers.Insert(0, handler);
                    }
                } while ((declaringType = declaringType.DeclaringType) != null &&
                         modulesInScope.Any(m => m.GetType() == declaringType));
            }

            routeHandlers.Add((LiaraMessageHandler)explorer.GetConfiguration().ActionInvoker);
            return(routeHandlers);
        }
Esempio n. 4
0
        public LiaraMessageHandlerCollection GetRouteHandlerCollection(MethodInfo method)
        {
            var routeHandlers = new LiaraMessageHandlerCollection();

            dynamic declaringType = method;
            if (declaringType != null)
            {
                var modulesInScope = explorer.GetLiaraModules();
                var allowAnonymous = false;
                do
                {
                    object[] handlers = declaringType.GetCustomAttributes(typeof (LiaraMessageHandler), false);
                    if (handlers.Length <= 0) continue;

                    foreach (
                        LiaraMessageHandler handler in handlers.OrderByDescending(h => ((LiaraMessageHandler) h).Order))
                    {
                        var type = handler.GetType();
                        if (allowAnonymous)
                        {
                            if (type == typeof (Authorize))
                            {
                                continue;
                            }
                        }
                        if (type == typeof (AllowAnonymous))
                        {
                            allowAnonymous = true;
                            continue;
                        }
                        routeHandlers.Insert(0, handler);
                    }
                } while ((declaringType = declaringType.DeclaringType) != null &&
                         modulesInScope.Any(m => m.GetType() == declaringType));

            }

            routeHandlers.Add((LiaraMessageHandler)explorer.GetConfiguration().ActionInvoker);
            return routeHandlers;
        }
Esempio n. 5
0
 public LiaraConfiguration()
 {
     handlers = new LiaraMessageHandlerCollection();
     formatters = new LiaraFormatterCollection();
     Items = new LiaraHashTable<object>(isCaseSensitive: true);
 }
Esempio n. 6
0
 public LiaraConfiguration()
 {
     handlers   = new LiaraMessageHandlerCollection();
     formatters = new LiaraFormatterCollection();
     Items      = new LiaraHashTable <object>(isCaseSensitive: true);
 }
Esempio n. 7
0
 public Route()
 {
     Id         = Guid.NewGuid();
     Handlers   = new LiaraMessageHandlerCollection();
     Parameters = new Dictionary <string, string>();
 }
Esempio n. 8
0
 public Route()
 {
     Id = Guid.NewGuid();
     Handlers = new LiaraMessageHandlerCollection();
     Parameters = new Dictionary<string, string>();
 }