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


C# ActionCall.OutputType方法代码示例

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


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

示例1: append_json

        public void append_json()
        {
            action = ActionCall.For<ControllerTarget>(x => x.OneInOneOut(null));
            action.AddToEnd(new RenderJsonNode(action.OutputType()));

            action.Next.ShouldBeOfType<RenderJsonNode>().ModelType.ShouldEqual(action.OutputType());
        }
开发者ID:JamieDraperUK,项目名称:fubumvc,代码行数:7,代码来源:ActionCallTester.cs

示例2: Apply

        public IEnumerable<IViewToken> Apply(ActionCall call, ViewBag views)
        {
            if(call.OutputType() == typeof(FubuContinuation) || !_policyResolver.HasMatchFor(call))
            {
                return new IViewToken[0];
            }

            string viewName = _policyResolver.ResolveViewName(call);
            string viewLocatorName = _policyResolver.ResolveViewLocator(call);
            IEnumerable<SparkViewToken> allViewTokens =
                views.Views.Where(view =>
                    view.GetType().CanBeCastTo<SparkViewToken>()).Cast<SparkViewToken>();

            SparkViewDescriptor matchedDescriptor = null;
            allViewTokens.FirstOrDefault(
                token =>
                {
                    matchedDescriptor = token.Descriptors
                        .Where(e => e.Templates
                                        .Any(template => template.Contains(viewLocatorName) && template.Contains(viewName)))
                        .SingleOrDefault();

                    return matchedDescriptor != null;
                });

            IEnumerable<IViewToken> viewsBoundToActions =
                matchedDescriptor != null
                    ? new IViewToken[] { new SparkViewToken(call, matchedDescriptor, viewLocatorName, viewName) }
                    : new IViewToken[0];

            return viewsBoundToActions;
        }
开发者ID:nhsevidence,项目名称:fubumvc,代码行数:32,代码来源:ActionAndViewMatchedBySparkViewDescriptors.cs

示例3: Find

 public IViewToken Find(ActionCall call, ViewBag views)
 {
     return views
         .ViewsFor(call.OutputType())
         .Select(view => view.ToViewToken())
         .FirstOrDefault();
 }
开发者ID:shashankshetty,项目名称:fubumvc,代码行数:7,代码来源:TypeAndNamespace.cs

示例4: IsRedirectable

        public static bool IsRedirectable(ActionCall action)
        {
            var outputType = action.OutputType();
            if (outputType == null) return false;

            return outputType.CanBeCastTo<FubuContinuation>() || outputType.CanBeCastTo<IRedirectable>();
        }
开发者ID:jemacom,项目名称:fubumvc,代码行数:7,代码来源:ContinuationHandlerConvention.cs

示例5: Apply

        public IEnumerable<IViewToken> Apply(ActionCall call, ViewBag views)
        {
            if(call.OutputType() == typeof(FubuContinuation) || !_policyResolver.HasMatchFor(call))
            {
                return new IViewToken[0];
            }

            var viewName = _policyResolver.ResolveViewName(call);
            var viewLocatorName = _policyResolver.ResolveViewLocator(call);
            var allViewTokens = views
                                    .Views
                                    .Where(view => view.GetType().CanBeCastTo<SparkViewToken>())
                                    .Cast<SparkViewToken>();

            SparkViewDescriptor matchedDescriptor = null;
            foreach(var token in allViewTokens)
            {
                var view = viewName.RemoveSuffix(".spark");
                var templatePath = !string.IsNullOrEmpty(viewLocatorName) ? "{0}\\{1}".ToFormat(viewLocatorName, view) : view;
                var descriptor = token
                                    .Descriptors
                                    .FirstOrDefault(d => d.Templates.Any(template => template.RemoveSuffix(".spark").Equals(templatePath)));

                if(descriptor != null)
                {
                    matchedDescriptor = descriptor;
                    break;
                }
            }

            return matchedDescriptor != null
                    ? new IViewToken[] { new SparkViewToken(call, matchedDescriptor, viewLocatorName, viewName) }
                    : new IViewToken[0];
        }
开发者ID:nieve,项目名称:fubumvc,代码行数:34,代码来源:ActionAndViewMatchedBySparkViewDescriptors.cs

示例6: GetSwaggerOperations

        public IEnumerable<Operation> GetSwaggerOperations(ActionCall call)
        {
            var parameters = createParameters(call);
            var outputType = call.OutputType();
            var route = call.ParentChain().Route;

            var verbs = getRouteVerbs(route);

            return verbs.Select(verb =>
                                          {
                                              var summary = call.InputType().GetAttribute<DescriptionAttribute>(d => d.Description);

                                              return new Operation
                                                         {
                                                             parameters = parameters.ToArray(),
                                                             httpMethod = verb,
                                                             responseTypeInternal = outputType.FullName,
                                                             responseClass = outputType.Name,
                                                             nickname = call.InputType().Name,
                                                             summary = summary,

                                                             //TODO not sure how we'd support error responses
                                                             errorResponses = new ErrorResponses[0],

                                                             //TODO get notes, nickname, summary from metadata?
                                                         };
                                          });
        }
开发者ID:styson,项目名称:fubumvc-swagger,代码行数:28,代码来源:SwaggerMapper.cs

示例7: Find

 public IViewToken Find(ActionCall call, ViewBag views)
 {
     return
         views
             .ViewsFor(call.OutputType())
             .Where(view => view.ViewType.Namespace == call.HandlerType.Namespace)
             .FirstOrDefault();
 }
开发者ID:paulbatum,项目名称:fubumvc,代码行数:8,代码来源:TypeAndNamespace.cs

示例8: Matches

        public bool Matches(ActionCall call, IConfigurationObserver log)
        {
            if (log.IsRecording)
            {
                log.RecordCallStatus(call, "This route will have /special in front of it");
            }

            //Use FubuCore.TypeExtensions to aid the readability of your conventions
            //by using .CanBeCastTo<>() and other helper methods to match against types
            return call.HasOutput && call.OutputType().CanBeCastTo<string>();
        }
开发者ID:sharpoverride,项目名称:introToFubu,代码行数:11,代码来源:AllStringOutputRoutesAreSpecialPolicy.cs

示例9: ActionToken

        public ActionToken(ActionCall call)
        {
            MethodName = call.Method.Name;
            HandlerType = new TypeToken(call.HandlerType);

            if (call.HasInput)
            {
                InputType = new TypeToken(call.InputType());
            }

            if (call.HasOutput)
            {
                OutputType = new TypeToken(call.OutputType());
            }
        }
开发者ID:jemacom,项目名称:fubumvc,代码行数:15,代码来源:ActionToken.cs

示例10: Apply

 public IEnumerable<IViewToken> Apply(ActionCall call, ViewBag views)
 {
     return views.ViewsFor(call.OutputType()).Where(view => view.Name == call.Method.Name && view.Folder == call.HandlerType.Namespace);
 }
开发者ID:jemacom,项目名称:fubumvc,代码行数:4,代码来源:ActionWithSameNameAndFolderAsViewReturnsViewModelType.cs

示例11: Apply

 public IEnumerable<IViewToken> Apply(ActionCall call, ViewBag views)
 {
     return views.ViewsFor(call.OutputType());
 }
开发者ID:joshuaflanagan,项目名称:fubumvc,代码行数:4,代码来源:ActionReturnsViewModelType.cs

示例12: addNewEntityPipeline

        private void addNewEntityPipeline(ActionCall action)
        {
            var lastAction = action;

            if (action.OutputType() == _entityType)
            {
                var handlerType = action.HandlerType;
                var editMethod = handlerType.GetMethod("Edit");
                var editPass = new ActionCall(handlerType, editMethod);
                action.AddAfter(editPass);

                lastAction = editPass;
            }

            lastAction.AddAfter(Wrapper.For<CrudUrlBehavior>());
        }
开发者ID:DarthFubuMVC,项目名称:FubuFastPack,代码行数:16,代码来源:CrudActionModifier.cs

示例13: Find

 public IEnumerable<IViewToken> Find(ActionCall call, ViewBag views)
 {
     return
         views.ViewsFor(call.OutputType()).Where(view => { return view.Namespace == call.HandlerType.Namespace; });
 }
开发者ID:,项目名称:,代码行数:5,代码来源:

示例14: Matches

 public bool Matches(ActionCall call)
 {
     return call.HandlerType.Name.EndsWith("Controller") && (!call.HasOutput || !call.OutputType().Equals(typeof(JsonResponse)));
 }
开发者ID:RobertTheGrey,项目名称:fubumvc,代码行数:4,代码来源:HelloSparkPolicy.asax.cs


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