本文整理汇总了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;
}
示例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;
}
示例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);
}