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


C# RouteData.GetRequiredString方法代码示例

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


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

示例1: GetActionDescriptor

 private static ActionDescriptor GetActionDescriptor(ControllerBase controller, RouteData routeData)
 {
     var controllerDescriptor = new ReflectedControllerDescriptor(controller.GetType());
     var actionName = routeData.GetRequiredString("action");
     var actionDescriptor = controllerDescriptor.FindAction(controller.ControllerContext, actionName);
     return actionDescriptor;
 }
开发者ID:sandermvanvliet,项目名称:Xania.AspNet,代码行数:7,代码来源:HttpControllerAction.cs

示例2: GetRequestedCog

        private Cog GetRequestedCog(RouteData routeData)
        {
            string package = routeData.GetRequiredString("package");

            if (routeData.Values.ContainsKey("version"))
                return Cogs.GetCog(package, new Version(routeData.Values["version"].ToString()));
            else
                return Cogs.GetCog(package);
        }
开发者ID:averyj,项目名称:cogs,代码行数:9,代码来源:GetCogHandler.cs

示例3: Log

        protected Log(RouteData data, HttpContextBase context) : base(context)
        {
            if (data == null) return;
            
            var route = data.Route as Route;
            if (route != null)
            {
                this.RouteConstraints = new Dictionary(route.Constraints);
                this.RouteDefaults = new Dictionary(route.Defaults);
                this.RouteUrl = route.Url;
            }

            this.RouteData = new Dictionary(data.Values);
            this.DataTokens = new Dictionary(data.DataTokens);

            this.Action = data.GetRequiredString("action").ToPascal();
            this.Controller = data.GetRequiredString("controller").ToPascal();
            this.Area = this.DataTokens.ContainsKey("area") ? this.DataTokens["area"].ToPascal() : string.Empty;
        }
开发者ID:stevenbey,项目名称:beyond.utilities,代码行数:19,代码来源:Log.cs

示例4: Create

		public override ControllerMeta Create(RouteData data)
		{
			TypedControllerMeta meta = null;

			var accessor = httpContext.ApplicationInstance as IContainerAccessor;
			if (accessor != null)
			{
				var container = accessor.Container;
				var controllerName = data.GetRequiredString("controller").ToLowerInvariant();

				if (!container.Kernel.HasComponent(controllerName)) return null;

				var args = CreateArgs();
				var controller = container.Resolve<object>(controllerName, args);

				var descriptor = DescriptorBuilder.Build(controller.GetType());

				meta = new TypedControllerMeta(controller, descriptor);
			}

			return meta;
		}
开发者ID:vietnt,项目名称:Castle.MonoRail3,代码行数:22,代码来源:WindsorControllerProvider.cs

示例5: IsControllerValid

 private static bool IsControllerValid(string controllerName, RouteData routeData)
 {
     return ((String.IsNullOrEmpty(controllerName)) || (routeData.GetRequiredString("controller") == controllerName));
 }
开发者ID:JuergenGutsch,项目名称:UsergroupWebsite,代码行数:4,代码来源:RequestContextExtensions.cs

示例6: IsActionValid

 private static bool IsActionValid(IEnumerable<string> actionNames, RouteData routeData)
 {
     return ((actionNames == null) || actionNames.Contains(routeData.GetRequiredString("action")));
 }
开发者ID:JuergenGutsch,项目名称:UsergroupWebsite,代码行数:4,代码来源:RequestContextExtensions.cs

示例7: GetActionName

 private static string GetActionName(RouteData routeData)
 {
     //if (DirectRouteExtensions.HasDirectRouteMatch(routeData)) return null;
     try
     {
         return routeData.GetRequiredString("action");
     }
     catch
     {
         return null;
     }
 }
开发者ID:Marvin-Brouwer,项目名称:CodedViews,代码行数:12,代码来源:ControllerBase.cs

示例8: GetTableFromRouteData

		public MetaTable GetTableFromRouteData (RouteData routeData)
		{
			if (routeData == null)
				throw new ArgumentNullException ("routeData");
			var t = routeData.GetRequiredString ("Table");
			if (Model == null)
				throw new InvalidOperationException ("MetaModel must be set to the DynamicDataRoute before retrieving MetaTable");

			return Model.GetTable (t);
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:10,代码来源:DynamicDataRoute.cs

示例9: GetActionFromRouteData

		public string GetActionFromRouteData (RouteData routeData)
		{
			if (routeData == null)
				throw new ArgumentNullException ("routeData");
			return routeData.GetRequiredString ("Action");
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:6,代码来源:DynamicDataRoute.cs

示例10: RouteRequiresPublicCaching

 private bool RouteRequiresPublicCaching(RouteData routeData)
 {
     if (routeData == null)
     {
         return false;
     }
     
     try
     {
         var controller = routeData.GetRequiredString("controller");
         var action = routeData.GetRequiredString("action");
         return (controller == "Help" && action == "Index");
     }
     catch
     {
         // request may be for asset
         return false;
     }
 }
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:19,代码来源:Global.asax.cs

示例11: GetViewName

 private static string GetViewName(RouteData routeData, string viewName)
 {
     return !string.IsNullOrEmpty(viewName)
            	? viewName
            	: routeData.GetRequiredString("action");
 }
开发者ID:MattHoneycutt,项目名称:BlackMagicMVC,代码行数:6,代码来源:RazorBridgeViewResult.cs

示例12: GetRequiredStringNull

		public void GetRequiredStringNull ()
		{
			var d = new RouteData ();
			d.GetRequiredString (null);
		}
开发者ID:nobled,项目名称:mono,代码行数:5,代码来源:RouteDataTest.cs

示例13: GetAreaName

        protected virtual string GetAreaName(RouteData routeData)
        {
            if (routeData.Values.ContainsKey("pluginName"))
            {
                var pluginName = routeData.GetRequiredString("pluginName");
                return pluginName;
            }

            object obj2;
            if (routeData.DataTokens.TryGetValue("area", out obj2))
            {
                return (obj2 as string);
            }
            return GetAreaName(routeData.Route);
        }
开发者ID:jefth,项目名称:PluginMvcWeb,代码行数:15,代码来源:ThemeableVirtualPathProviderViewEngine.cs

示例14: GetTableFromRouteData

 /// <summary>
 /// Extract the MetaTable from the RouteData. Fails if it can't find it
 /// </summary>
 /// <param name="routeData">The route data</param>
 /// <returns>The found MetaTable</returns>
 public MetaTable GetTableFromRouteData(RouteData routeData) {
     string tableName = routeData.GetRequiredString(TableToken);
     return Model.GetTable(tableName);
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:9,代码来源:DynamicDataRoute.cs

示例15: CurrentPageIsBasket

 public static bool CurrentPageIsBasket(RouteData routeData) 
 {
     return routeData.GetRequiredString("controller").IsCaseInsensitiveEqual("ShoppingCart")
         && routeData.GetRequiredString("action").IsCaseInsensitiveEqual("Cart");
 }
开发者ID:codesharpdev,项目名称:SmartStore.PayUMea,代码行数:5,代码来源:PayUMeaHelper.cs


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