当前位置: 首页>>代码示例>>C#>>正文


C# RouteValueDictionary.AddOrReplace方法代码示例

本文整理汇总了C#中RouteValueDictionary.AddOrReplace方法的典型用法代码示例。如果您正苦于以下问题:C# RouteValueDictionary.AddOrReplace方法的具体用法?C# RouteValueDictionary.AddOrReplace怎么用?C# RouteValueDictionary.AddOrReplace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RouteValueDictionary的用法示例。


在下文中一共展示了RouteValueDictionary.AddOrReplace方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetUrl

        /// <summary>
        /// 获取导航Url
        /// </summary>
        /// <param name="presentAreaNavigation">被扩展的navigation</param>
        /// <param name="spaceKey">空间标识</param>
        /// <param name="routeValueDictionary">路由数据集合</param>
        /// <returns></returns>
        public static string GetUrl(this PresentAreaNavigation presentAreaNavigation, string spaceKey, RouteValueDictionary routeValueDictionary = null)
        {
            RouteValueDictionary routeDatas = null;
            if (!string.IsNullOrEmpty(presentAreaNavigation.UrlRouteName))
            {
                if (!string.IsNullOrEmpty(presentAreaNavigation.RouteDataName) && routeValueDictionary != null)
                {
                    string[] routeNames = presentAreaNavigation.RouteDataName.Split(',');
                    routeDatas = new RouteValueDictionary(routeValueDictionary.Where(n => routeNames.Contains(n.Key)).ToDictionary(n => n.Key, n => n.Value));

                    if (!routeNames.Contains("userName") && !routeNames.Contains("spaceKey"))
                    {
                        routeDatas.AddOrReplace("sapceKey", spaceKey);
                    }
                }
                else
                    routeDatas = new RouteValueDictionary() { { "spaceKey", spaceKey } };
                return CachedUrlHelper.RouteUrl(presentAreaNavigation.UrlRouteName, routeDatas);
            }

            if (presentAreaNavigation.NavigationUrl != null && !string.IsNullOrEmpty(presentAreaNavigation.NavigationUrl.Trim()))
            {
                return presentAreaNavigation.NavigationUrl;
            }
            return string.Empty;
        }
开发者ID:hbulzy,项目名称:SYS,代码行数:33,代码来源:PresentAreaNavigationExtensions.cs

示例2: CreateFromRequestContext

 public static RouteValueDictionary CreateFromRequestContext(RequestContext requestContext)
 {
     RouteValueDictionary routeValues = new RouteValueDictionary(requestContext.RouteData.Values);
     foreach (string key in requestContext.HttpContext.Request.QueryString.AllKeys)
     {
         routeValues.AddOrReplace(key, requestContext.HttpContext.Request.QueryString[key]);
     }
     return routeValues;
 }
开发者ID:beardeddev,项目名称:shamrock,代码行数:9,代码来源:RouteValueDictionaryExtensions.cs

示例3: GetUrl

        /// <summary>
        /// 获取快捷操作Url
        /// </summary>
        /// <param name="applicationManagementOperation">被扩展的applicationManagementOperation</param>
        /// <param name="spaceKey">空间标识</param>
        /// <param name="routeValueDictionary">路由数据字典</param>
        /// <returns></returns>
        public static string GetUrl(this ApplicationManagementOperation applicationManagementOperation, string spaceKey, RouteValueDictionary routeValueDictionary = null)
        {
            if (applicationManagementOperation.NavigationUrl != null && !string.IsNullOrEmpty(applicationManagementOperation.NavigationUrl.Trim()))
            {
                return applicationManagementOperation.NavigationUrl;
            }

            RouteValueDictionary routeDatas = null;
            if (!string.IsNullOrEmpty(applicationManagementOperation.RouteDataName) && routeValueDictionary != null)
            {
                string[] routeNames = applicationManagementOperation.RouteDataName.Split(',');
                routeDatas = new RouteValueDictionary(routeValueDictionary.Where(n => routeNames.Contains(n.Key)).ToDictionary(n => n.Key, n => n.Value));
                routeDatas.AddOrReplace("sapceKey", spaceKey);
                return CachedUrlHelper.RouteUrl(applicationManagementOperation.UrlRouteName, routeDatas);
            }

            RouteValueDictionary routeValues = new RouteValueDictionary() { { "spaceKey", spaceKey } };

            return CachedUrlHelper.RouteUrl(applicationManagementOperation.UrlRouteName, routeValues);
        }
开发者ID:ClaytonWang,项目名称:Dw3cSNS,代码行数:27,代码来源:ApplicationManagementOperationExtensions.cs


注:本文中的RouteValueDictionary.AddOrReplace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。