Esempio n. 1
0
        private void LoadFrom(Type type, MethodInfo method, RouteAttribute attrib)
        {
            RouteType    = type;
            HttpMethod   = attrib.Method;
            Pattern      = attrib.Pattern;
            MethodParams = method.GetParameters();

            Filters.AddRange(type.GetCustomAttributes <FilterAttribute>());
            Filters.AddRange(method.GetCustomAttributes <FilterAttribute>());

            var transformerAttrib = method.GetCustomAttribute <TransformerAttribute>() ?? type.GetCustomAttribute <TransformerAttribute>();

            if (transformerAttrib != null)
            {
                BodyTransformer = transformerAttrib.Transformer;
            }

            _constructor = type.BindConstructor();

            _contextSetDelegate = type.BindSetProperty(p => p.PropertyType == typeof(HttpListenerContext));

            _delegate = method.BindFastInvoker();
        }