示例#1
0
        private void Init()
        {
            _routeElements = new List <RouteElement>();

            // Split string into tokens
            string[] routeStringParts = _routeString.Split(' ');

            // Create first element
            RouteElement firstElement = RouteElementFactory
                                        .GetRouteElement(null, routeStringParts[0], routeStringParts[1]);

            _routeElements.Add(firstElement);

            // Create middle elements
            for (int i = 1; i < routeStringParts.Length - 1; i++)
            {
                RouteElement tempElement = RouteElementFactory
                                           .GetRouteElement(_routeElements[_routeElements.Count - 1], routeStringParts[i], routeStringParts[i + 1]);
                _routeElements.Add(tempElement);
            }

            // Create last element
            RouteElement lastElement = RouteElementFactory
                                       .GetRouteElement(_routeElements[_routeElements.Count - 1], routeStringParts[routeStringParts.Length - 1], string.Empty);

            _routeElements.Add(lastElement);
        }
        private void DesignRouteClickDispatcher(ElementBase element)
        {
            RouteElement re       = null;
            IRoutable    relement = element as IRoutable;

            // Avoid add no routebale elements to the route
            if (relement == null)
            {
                return;
            }

            // Set next route status
            relement.SetRouteNextStatus();

            if (!relement.ActivatedInRoute)
            {
                this.Route.RemoveByElement(element);
            }
            else
            {
                re = this.Route.GetByElement(element);
                if (re == null)
                {
                    re         = new RouteElement();
                    re.ID      = element.ID;
                    re.Element = element;
                    re.Route   = this.Route;
                }
                re.AccessoryStatus = ElementBase.GetAccessoryStatus(element);

                this.Route.Add(re);
            }

            this.RepaintCoordinates(element.Coordinates);
        }
        /// <summary>
        /// Save the current loaded route.
        /// </summary>
        internal bool RouteSave()
        {
            try
            {
                if (!this.MapViewToEntity())
                {
                    return(false);
                }

                // Save the route
                Route.Save(this.Route);
                foreach (RouteElement routeElement in this.Route.Elements)
                {
                    // TODO: This secuence should be implemented inside the ORM layer
                    RouteElement.Save(routeElement);
                }

                // Add the route into the project
                if (!OTCContext.Project.Routes.Contains(this.Route))
                {
                    OTCContext.Project.Routes.Add(this.Route);
                }

                this.HasChanges = false;

                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(Logger.LogError(this, ex), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
示例#4
0
        protected virtual RouteValueDictionary GetConstraints(RouteElement route)
        {
            try
            {
                var dictionary = GetDictionaryFromAttributes(route.Constraints.Attributes);

                for (var i = 0; i < route.Constraints.Count; i++)
                {
                    var constraint          = route.Constraints[i];
                    var routeConstraintType = Type.GetType(constraint.Type);

                    IRouteConstraint routeConstraint;
                    if (constraint.Params.Attributes.Count > 0)
                    {
                        var parameters = constraint.Params.Attributes.Values.ToArray();
                        routeConstraint = (IRouteConstraint)Activator.CreateInstance(routeConstraintType, parameters);
                    }
                    else
                    {
                        routeConstraint = (IRouteConstraint)Activator.CreateInstance(routeConstraintType);
                    }

                    dictionary.Add(constraint.Name, routeConstraint);
                }

                return(dictionary);
            }
            catch (Exception ex)
            {
                var message = String.Format("Can't create an instance of IRouteHandler {0}", route.RouteHandlerType);
                throw new ApplicationException(message, ex);
            }
        }
示例#5
0
        /// <summary>
        /// Adds a new item into the project.
        /// </summary>
        /// <param name="item">Item to add.</param>
        public void Add(RouteElement item)
        {
            try
            {
                // Create the new item into the DB
                OTCProject.LayoutManager.RouteElementDAO.Add(item);

                // Add the new item into the in-memory project
                this.RouteElements.Add(item);
                item.Route.Elements.Add(item);
            }
            catch (Exception ex)
            {
                Logger.LogError(this, ex);
                throw;
            }
        }
示例#6
0
        /// <summary>
        /// Delete the specified item from the project.
        /// </summary>
        /// <param name="item">Item to remove.</param>
        public void Remove(RouteElement item)
        {
            try
            {
                // Create the new element into the DB
                OTCProject.LayoutManager.RouteElementDAO.Delete(item.ID);

                // Remove the element from the in-memory project
                item.Route.Elements.Remove(item);
                this.RouteElements.Remove(item);
            }
            catch (Exception ex)
            {
                Logger.LogError(this, ex);
                throw;
            }
        }
示例#7
0
        /// <summary>
        /// Repaints the switchboard specified coordinates.
        /// </summary>
        /// <param name="coords">The to repaint.</param>
        public void RepaintCoordinates(Point coords)
        {
            int          widthInBlocks;
            Element      element;
            RouteElement routeElement = null;
            Rectangle    rect         = new Rectangle(0, 0, 0, 0);
            Point        paintCoords;

            // Get involved elements
            element = this.Switchboard.GetBlock(coords);
            if (this.ActiveRoute != null && element != null)
            {
                routeElement = this.ActiveRoute.GetByElement(element);
            }

            // Get the element placed in coordinates
            widthInBlocks = element != null ? element.Properties.Width : 1;
            paintCoords   = element != null ? element.Coordinates : coords;

            using (Graphics g = this.CreateGraphics())
            {
                for (int i = 1; i < widthInBlocks + 1; i++)
                {
                    // Get the cell rectabgle
                    rect = new Rectangle(this.GetElementPosition(this.GetRealCoordinates(paintCoords)), OTCContext.Project.Theme.ElementSize);

                    // Delete cell previous drawing
                    this.RemoveCellImage(g, rect);

                    // Paint the element (if exists in that position)
                    if (element != null)
                    {
                        this.DrawCellImage(g, rect.Location, element, routeElement);
                    }

                    paintCoords.X++;
                }

                // Draw a cell highlight layer
                if (rect != null && this.SelectedCell != null && (this.SelectedCell.Equals(coords)))
                {
                    this.DrawCellHighlight(g, rect);
                }
            }
        }
示例#8
0
        protected virtual IRouteHandler GetInstanceOfRouteHandler(RouteElement route)
        {
            if (String.IsNullOrEmpty(route.RouteHandlerType))
            {
                return(new MvcRouteHandler());
            }

            try
            {
                Type routeHandlerType = Type.GetType(route.RouteHandlerType);
                return(Activator.CreateInstance(routeHandlerType) as IRouteHandler);
            }
            catch (Exception ex)
            {
                var message = String.Format("Can't create an instance of IRouteHandler {0}", route.RouteHandlerType);
                throw new ApplicationException(message, ex);
            }
        }
示例#9
0
        protected virtual RouteValueDictionary GetDefaults(RouteElement route)
        {
            var dataTokensDictionary = new RouteValueDictionary();

            foreach (var dataToken in route.Defaults.Attributes)
            {
                if (dataToken.Value.Equals(Optional, StringComparison.InvariantCultureIgnoreCase))
                {
                    dataTokensDictionary.Add(dataToken.Key, UrlParameter.Optional);
                }
                else
                {
                    dataTokensDictionary.Add(dataToken.Key, dataToken.Value);
                }
            }

            return(dataTokensDictionary);
        }
示例#10
0
        public static MvcHtmlString NavbarLink(this HtmlHelper helper, string name, string actionName, string controllerName)
        {
            var sb           = new StringBuilder();
            var routeElement = new RouteElement {
                Action = actionName, Controller = controllerName
            };
            var currentUserRoles = new string[] { "Unregister" };

            if (WebSecurity.IsAuthenticated)
            {
                var userRolesProvider = (SimpleRoleProvider)System.Web.Security.Roles.Provider;
                var userName          = WebSecurity.CurrentUserName;
                currentUserRoles = userRolesProvider.GetRolesForUser(userName);
            }

            if (!SecurityStuffs.GetInstance().HasPermmisions(currentUserRoles, routeElement))
            {
                return(new MvcHtmlString(sb.ToString()));
            }

            string currentControllerName = (string)helper.ViewContext.RouteData.Values["controller"];
            string currentActionName     = (string)helper.ViewContext.RouteData.Values["action"];

            string isActiveClass = "";

            if (currentControllerName.Equals(controllerName, StringComparison.CurrentCultureIgnoreCase) && currentActionName.Equals(actionName, StringComparison.CurrentCultureIgnoreCase))
            {
                isActiveClass = " class=\"active\"";
            }

            sb.AppendFormat("<li {0}>", isActiveClass);
            var url = new UrlHelper(HttpContext.Current.Request.RequestContext);

            sb.AppendFormat("<a href=\"{0}\">{1}</a>", url.Action(actionName, controllerName), name);
            sb.Append("</li>");

            return(new MvcHtmlString(sb.ToString()));
        }
示例#11
0
        private void DesignRouteClickDispatcher(Element element)
        {
            // Avoid add no routebale elements to the route
            if (element == null || !element.Properties.IsRouteable)
            {
                return;
            }

            if (element.Properties.IsAccessory)
            {
                this.ShowAccessoryMenu(element);
            }
            else
            {
                // Get the corresponding route element
                RouteElement routeElement = this.Route.GetByElement(element);
                if (routeElement == null)
                {
                    routeElement = new RouteElement(this.Route, element);
                    this.Route.Elements.Add(routeElement);
                    element.RouteElement = routeElement;
                    // RouteElement.Save(routeElement);
                }

                routeElement.SetNextStatus();

                if (!routeElement.IsValid)
                {
                    this.Route.RemoveByElement(element);
                    // RouteElement.Delete(routeElement);
                    element.RouteElement = null;
                }

                this.RepaintCoordinates(element.Coordinates);
            }
        }
示例#12
0
        private void SaveCurrentRoute()
        {
            // Save the route
            Route.Save(this.Route);
            foreach (RouteElement routeElement in this.Route.Elements)
            {
                if (routeElement.Element != null)
                {
                    RouteElement.Save(routeElement);
                }
                else
                {
                    RouteElement.Delete(routeElement); // unused route element
                }
            }

            // Add the route into the project
            if (!OTCContext.Project.Routes.Contains(this.Route))
            {
                OTCContext.Project.Routes.Add(this.Route);
            }

            this.HasChanges = false;
        }
示例#13
0
        public static RouteElement GetRouteElement(RouteElement previous, string current, string next)
        {
            // Check Direct
            if (Direct.IsValid(current))
            {
                //Create a new Direct element
                return(new Direct());
            }

            // First element
            if (previous == null)
            {
                //Either SpeedLevel or Airway
                if (SpeedLevel.IsValid(current))
                {
                    return(new SpeedLevel(current));
                }
                // Definitely airway
                else
                {
                    return(new Airway(current));
                }
            }
            // Middle element or last element
            else
            {
                // Last element
                if (next.Equals(string.Empty))
                {
                    // Either NamedPoint, CoordinatePoint or NavaidPoint or STAR(TO BE IMPLEMENTED)
                    // TODO: Implement STAR
                    return(GetSignificantPoint(current));
                }
                // Middle element
                else
                {
                    // Either ChangeOfFlightRule, ChangeOfSpeedLevelPoint, NavaidPoint, CoordinatePoint, NamedPoint or Airway
                    // Check ChangeOfFlightRule
                    if (ChangeOfFlightRule.IsValid(current))
                    {
                        return(new ChangeOfFlightRule(current));
                    }
                    // Check ChangeOfSpeedLevelPoint
                    else if (ChangeOfSpeedLevelPoint.IsValid(current))
                    {
                        string[] currentParts = current.Split('/');

                        SignificantPoint significantPoint = GetSignificantPoint(currentParts[0]);
                        SpeedLevel       speedLevel       = new SpeedLevel(currentParts[1]);

                        return(new ChangeOfSpeedLevelPoint(significantPoint, speedLevel));
                    }
                    // Check CoordinatePoint before checking airway since they can be adjacent
                    else if (CoordinatePoint.IsValid(current))
                    {
                        //Create CoordinatePoint
                        return(new CoordinatePoint(current));
                    }
                    // Either SignificantPoint or Airway
                    // Find the type of previous element
                    else if (previous is Airway | previous is SpeedLevel | previous is Direct)
                    {
                        // Current is a NamedPoint
                        return(GetSignificantPoint(current));
                    }
                    else
                    {
                        // Current is an Airway
                        return(new Airway(current));
                    }
                }
            }
        }
示例#14
0
        private MetadataValidationResult BuildServiceMapping(XmlDocSource xmlDocSource, RouteElement route, List <Type> seenTypes, JObject smdBase, bool includeDemoValue, JObject schema)
        {
            var result = new MetadataValidationResult();

            Type type = xmlDocSource.RouteAssembly.Assembly.GetType(route.Type.Substring(0, route.Type.IndexOf(",")));

            if (seenTypes.Contains(type))
            {
                return(result);
            }

            seenTypes.Add(type);

            var typeElement = type.GetXmlDocTypeNodeWithSMD();

            if (typeElement == null)
            {
                return(result);
            }

            var methodTarget = route.Endpoint.Trim('/');

            foreach (var method in type.GetMethods(BindingFlags.Public | BindingFlags.Instance))
            {
                var methodElement = type.GetXmlDocMemberNodeWithSMD(type.FullName + "." + method.Name);
                if (methodElement == null)
                {
                    continue;
                }

                // get smd xml, if present
                var methodSmdElement = methodElement.XPathSelectElement("smd");
                if (methodSmdElement == null)
                {
                    result.AddMetadataGenerationError(new MetadataGenerationError(MetadataType.SMD, type, "should not have gotten a method element without smd", "All services that have XML comments must have a <smd> tag.  See https://github.com/cityindex/RESTful-Webservice-Schema/wiki/Howto-write-XML-comments-for-SMD for details"));
                    continue; //advance to next service method
                }

                var smdXmlComment = SmdXmlComment.CreateFromXml(methodSmdElement);

                //Don't document methods that are marked exclude
                if (smdXmlComment.Exclude)
                {
                    continue; //advance to next service method
                }
                JObject service    = null;
                var     opContract = ReflectionUtils.GetAttribute <OperationContractAttribute>(method);

                if (opContract != null)
                {
                    var webGet     = ReflectionUtils.GetAttribute <WebGetAttribute>(method);
                    var methodName = method.Name;
                    if (!string.IsNullOrEmpty(smdXmlComment.MethodName))
                    {
                        methodName = smdXmlComment.MethodName;
                    }

                    string methodTransport   = null;
                    string methodEnvelope    = null;
                    string methodUriTemplate = null;

                    if (webGet != null)
                    {
                        service           = new JObject();
                        methodUriTemplate = ResolveUriTemplate(smdXmlComment, webGet.UriTemplate);
                        methodTransport   = "GET";
                        methodEnvelope    = "URL";
                    }
                    else
                    {
                        var webInvoke = ReflectionUtils.GetAttribute <WebInvokeAttribute>(method);
                        if (webInvoke != null)
                        {
                            service           = new JObject();
                            methodUriTemplate = ResolveUriTemplate(smdXmlComment, webInvoke.UriTemplate);

                            switch (webInvoke.Method.ToUpper())
                            {
                            case "POST":
                                methodTransport = "POST";
                                methodEnvelope  = "JSON";
                                break;

                            case "GET":
                                methodTransport = "GET";
                                methodEnvelope  = "URL";
                                break;

                            default:
                                result.AddMetadataGenerationError(new MetadataGenerationError(MetadataType.SMD, type,
                                                                                              string.Format("The {0} service has transport method of type {1} that is not supported", methodName, webInvoke.Method), "Service transports like DELETE or PUT are poorly supported by client http clients, so you advised to only use GET or POST"));
                                continue;     //advance to next service method
                            }
                        }
                    }

                    if (service != null)
                    {
                        JsonSchemaUtilities.ApplyDescription(service, methodElement);

                        service.Add("target", ResolveEndpoint(smdXmlComment, methodTarget));

                        if (!string.IsNullOrWhiteSpace(methodUriTemplate))
                        {
                            service.Add("uriTemplate", methodUriTemplate);
                        }
                        service.Add("contentType", "application/json");         // TODO: declare this in meta or get from WebGet/WebInvoke
                        service.Add("responseContentType", "application/json"); // TODO: declare this in meta or get from WebGet/WebInvoke
                        service.Add("transport", methodTransport);

                        try
                        {
                            smdBase.Add(methodName, service);
                        }
                        catch (ArgumentException e)
                        {
                            result.AddMetadataGenerationError(new MetadataGenerationError(MetadataType.SMD, type, string.Format("A service with the method name {0} already exists", methodName), "Ensure that methods names are unique across services"));
                            return(result);
                        }

                        // this is not accurate/valid SMD for GET but dojox.io.services is not, yet, a very good
                        // implementation of the SMD spec, which is funny as they were both written by the same person.
                        service.Add("envelope", methodEnvelope);

                        // determine if return type is object or primitive
                        JObject returnType = null;
                        if (Type.GetTypeCode(method.ReturnType) == TypeCode.Object)
                        {
                            if (method.ReturnType.Name != "Void")
                            {
                                string methodReturnTypeName = method.ReturnType.Name;
                                if (schema["properties"][methodReturnTypeName] == null)
                                {
                                    result.AddMetadataGenerationError(new MetadataGenerationError(MetadataType.SMD, type, "Schema missing referenced return type " + methodReturnTypeName + " for method " + method.Name, "All types used by services must be decorated with the <jschema> tag.  See https://github.com/cityindex/RESTful-Webservice-Schema/wiki/Howto-write-XML-comments-for-JSchema"));
                                }
                                returnType = new JObject(new JProperty("$ref", JsonSchemaUtilities.RootDelimiter + methodReturnTypeName));
                            }
                            else
                            {
                                returnType = null;
                            }
                        }
                        else if (Type.GetTypeCode(method.ReturnType) == TypeCode.Empty)
                        {
                            returnType = null;
                        }
                        else
                        {
                            returnType = new JObject(new JProperty("type", method.ReturnType.GetSchemaType()["type"].Value <string>()));
                        }
                        if (returnType != null)
                        {
                            service.Add("returns", returnType);
                        }

                        SetStringAttribute(methodSmdElement, service, "group");
                        SetIntAttribute(methodSmdElement, service, "cacheDuration");
                        SetStringAttribute(methodSmdElement, service, "throttleScope");

                        var paramResult = AddParameters(type, method, methodElement, service, includeDemoValue, schema);
                        if (paramResult.HasErrors)
                        {
                            result.AddMetadataGenerationErrors(paramResult.MetadataGenerationErrors);
                        }
                    }
                }
                if (!result.HasErrors)
                {
                    result.AddMetadataGenerationSuccess(new MetadataGenerationSuccess(MetadataType.SMD, type));
                }
            }

            return(result);
        }
示例#15
0
 /// <summary>
 /// Draw the element image on the cell.
 /// </summary>
 public void DrawCellImage(Graphics g, Point point, Element element, RouteElement routeElement = null)
 {
     g.DrawImage(element.GetImage(OTCContext.Project.Theme, this.DesignModeEnabled), point);
 }
示例#16
0
        private MetadataValidationResult BuildServiceMapping(XmlDocSource xmlDocSource, RouteElement route, List<Type> seenTypes, JObject smdBase, bool includeDemoValue, JObject schema)
        {
            var result = new MetadataValidationResult();

            Type type = xmlDocSource.RouteAssembly.Assembly.GetType(route.Type.Substring(0, route.Type.IndexOf(",")));
            if (seenTypes.Contains(type))
            {
                return result;
            }

            seenTypes.Add(type);

            var typeElement = type.GetXmlDocTypeNodeWithSMD();

            if (typeElement == null)
            {
                return result;
            }

            var methodTarget = route.Endpoint.Trim('/');

            foreach (var method in type.GetMethods(BindingFlags.Public | BindingFlags.Instance))
            {
                var methodElement = type.GetXmlDocMemberNodeWithSMD(type.FullName + "." + method.Name);
                if (methodElement == null)
                {
                    continue;
                }

                // get smd xml, if present
                var methodSmdElement = methodElement.XPathSelectElement("smd");
                if (methodSmdElement == null)
                {
                    result.AddMetadataGenerationError(new MetadataGenerationError(MetadataType.SMD, type, "should not have gotten a method element without smd", "All services that have XML comments must have a <smd> tag.  See https://github.com/cityindex/RESTful-Webservice-Schema/wiki/Howto-write-XML-comments-for-SMD for details"));
                    continue; //advance to next service method
                }

                var smdXmlComment = SmdXmlComment.CreateFromXml(methodSmdElement);

                //Don't document methods that are marked exclude
                if (smdXmlComment.Exclude)
                    continue; //advance to next service method

                JObject service = null;
                var opContract = ReflectionUtils.GetAttribute<OperationContractAttribute>(method);

                if (opContract != null)
                {
                    var webGet = ReflectionUtils.GetAttribute<WebGetAttribute>(method);
                    var methodName = method.Name;
                    if (!string.IsNullOrEmpty(smdXmlComment.MethodName))
                        methodName = smdXmlComment.MethodName;

                    string methodTransport = null;
                    string methodEnvelope = null;
                    string methodUriTemplate = null;

                    if (webGet != null)
                    {
                        service = new JObject();
                        methodUriTemplate = ResolveUriTemplate(smdXmlComment, webGet.UriTemplate);
                        methodTransport = "GET";
                        methodEnvelope = "URL";
                    }
                    else
                    {
                        var webInvoke = ReflectionUtils.GetAttribute<WebInvokeAttribute>(method);
                        if (webInvoke != null)
                        {
                            service = new JObject();
                            methodUriTemplate = ResolveUriTemplate(smdXmlComment, webInvoke.UriTemplate);

                            switch (webInvoke.Method.ToUpper())
                            {
                                case "POST":
                                    methodTransport = "POST";
                                    methodEnvelope = "JSON";
                                    break;
                                case "GET":
                                    methodTransport = "GET";
                                    methodEnvelope = "URL";
                                    break;
                                default:
                                    result.AddMetadataGenerationError(new MetadataGenerationError(MetadataType.SMD, type,
                                        string.Format("The {0} service has transport method of type {1} that is not supported", methodName, webInvoke.Method), "Service transports like DELETE or PUT are poorly supported by client http clients, so you advised to only use GET or POST"));
                                    continue; //advance to next service method
                            }

                        }
                    }

                    if (service != null)
                    {
                        JsonSchemaUtilities.ApplyDescription(service, methodElement);

                        service.Add("target", ResolveEndpoint(smdXmlComment, methodTarget));

                        if (!string.IsNullOrWhiteSpace(methodUriTemplate))
                        {
                            service.Add("uriTemplate", methodUriTemplate);
                        }
                        service.Add("contentType", "application/json");// TODO: declare this in meta or get from WebGet/WebInvoke
                        service.Add("responseContentType", "application/json");// TODO: declare this in meta or get from WebGet/WebInvoke
                        service.Add("transport", methodTransport);

                        try
                        {
                            smdBase.Add(methodName, service);
                        }
                        catch (ArgumentException e)
                        {
                            result.AddMetadataGenerationError(new MetadataGenerationError(MetadataType.SMD, type, string.Format("A service with the method name {0} already exists", methodName), "Ensure that methods names are unique across services"));
                            return result;
                        }

                        // this is not accurate/valid SMD for GET but dojox.io.services is not, yet, a very good
                        // implementation of the SMD spec, which is funny as they were both written by the same person.
                        service.Add("envelope", methodEnvelope);

                        // determine if return type is object or primitive
                        JObject returnType = null;
                        if (Type.GetTypeCode(method.ReturnType) == TypeCode.Object)
                        {
                            if (method.ReturnType.Name != "Void")
                            {
                                string methodReturnTypeName = method.ReturnType.Name;
                                if (schema["properties"][methodReturnTypeName] == null)
                                {
                                    result.AddMetadataGenerationError(new MetadataGenerationError(MetadataType.SMD, type, "Schema missing referenced return type " + methodReturnTypeName + " for method " + method.Name, "All types used by services must be decorated with the <jschema> tag.  See https://github.com/cityindex/RESTful-Webservice-Schema/wiki/Howto-write-XML-comments-for-JSchema"));
                                }
                                returnType = new JObject(new JProperty("$ref", JsonSchemaUtilities.RootDelimiter + methodReturnTypeName));
                            }
                            else
                            {
                                returnType = null;
                            }

                        }
                        else if (Type.GetTypeCode(method.ReturnType) == TypeCode.Empty)
                        {
                            returnType = null;

                        }
                        else
                        {
                            returnType = new JObject(new JProperty("type", method.ReturnType.GetSchemaType()["type"].Value<string>()));
                        }
                        if (returnType != null)
                        {
                            service.Add("returns", returnType);
                        }

                        SetStringAttribute(methodSmdElement, service, "group");
                        SetIntAttribute(methodSmdElement, service, "cacheDuration");
                        SetStringAttribute(methodSmdElement, service, "throttleScope");

                        var paramResult = AddParameters(type, method, methodElement, service, includeDemoValue, schema);
                        if (paramResult.HasErrors)
                            result.AddMetadataGenerationErrors(paramResult.MetadataGenerationErrors);
                    }

                }
                if (!result.HasErrors)
                    result.AddMetadataGenerationSuccess(new MetadataGenerationSuccess(MetadataType.SMD, type));
            }

            return result;
        }
示例#17
0
 protected virtual RouteValueDictionary GetDataTokens(RouteElement route)
 {
     return(GetDictionaryFromAttributes(route.DataTokens.Attributes));
 }