Esempio n. 1
0
        public override string CreateUrl(string action, string typeName, string propertyName, string dataKey)
        {
            if (action == null || action == String.Empty)
            {
                throw new ArgumentNullException("action");
            }

            if (typeName == null || typeName == String.Empty)
            {
                throw new ArgumentNullException("typeName");
            }

            if (propertyName == null || propertyName == String.Empty)
            {
                throw new ArgumentNullException("propertyName");
            }

            if (dataKey == null || dataKey == String.Empty)
            {
                throw new ArgumentNullException("dataKey");
            }

            return("http://localhost/TestApplication/" + EntitiesUtilities.FormatUniqueKey(action)
                   + "-" + EntitiesUtilities.FormatUniqueKey(typeName)
                   + "/" + EntitiesUtilities.FormatUniqueKey(propertyName)
                   + "--" + EntitiesUtilities.FormatUniqueKey(dataKey));
        }
Esempio n. 2
0
        /// <summary>
        /// Prepares the provided text for use in a URL.
        /// </summary>
        /// <param name="text">The text to prepare for use in a URL.</param>
        /// <returns>The prepared version of the provided text.</returns>
        public string PrepareForUrl(string text)
        {
            // Swap double spaces for single ones to avoid confusing the ProjectionMapper
            while (text.Replace("  ", " ").Length < text.Length)
            {
                text = text.Replace("  ", " ");
            }

            text = EntitiesUtilities.FormatUniqueKey(text);

            text = HttpUtility.UrlEncode(text);

            // Swap double dashes for single ones to avoid confusing the ProjectionMapper
            while (text.Replace("--", "-").Length < text.Length)
            {
                text = text.Replace("--", "-");
            }

            return(text);
        }