• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Querying.ChainSearch类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中FubuMVC.Core.Registration.Querying.ChainSearch的典型用法代码示例。如果您正苦于以下问题:C# ChainSearch类的具体用法?C# ChainSearch怎么用?C# ChainSearch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ChainSearch类属于FubuMVC.Core.Registration.Querying命名空间,在下文中一共展示了ChainSearch类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: find_by_null_category_with_multiple_chains_but_only_one_is_default

        public void find_by_null_category_with_multiple_chains_but_only_one_is_default()
        {
            var search = new ChainSearch
            {
                CategoryMode = CategorySearchMode.Relaxed,
                CategoryOrHttpMethod = null
            };

            var chain1 = new RoutedChain(""){
                UrlCategory ={
                    Category = null
                }
            };

            var chain2 = new RoutedChain("")
            {
                UrlCategory =
                {
                    Category = Categories.DEFAULT
                }
            };

            var chains = new BehaviorChain[] { chain1, chain2};

            search.FindForCategory(chains).Single().ShouldBeTheSameAs(chain2);
        }
开发者ID:DarthFubuMVC,项目名称:fubumvc,代码行数:26,代码来源:ChainSearchTester.cs


示例2: find

        private Func<BehaviorChain> find(ChainSearch search)
        {
            var candidates = search.FindCandidates(_behaviorGraph);

            var count = candidates.Count();
            switch (count)
            {
                case 1:
                    var chain = candidates.Single();
                    return () => chain;

                case 0:
                    return () =>
                    {
                        throw new FubuException(2104, "No behavior chains are registered matching criteria:  " + search);
                    };

                default:
                    var message = "More than one behavior chain matching criteria:  " + search;
                    message += "\nMatches:";

                    candidates.Each(x =>
                    {
                        message += "\n" + x;
                    });

                    return () =>
                    {
                        throw new FubuException(2108, message);
                    };
            }
        }
开发者ID:kingreatwill,项目名称:fubumvc,代码行数:32,代码来源:ChainResolutionCache.cs


示例3: find_by_category_when_the_category_is_null_and_relaxed_search_and_only_one_chain

        public void find_by_category_when_the_category_is_null_and_relaxed_search_and_only_one_chain()
        {
            var search = new ChainSearch{
                CategoryMode = CategorySearchMode.Relaxed,
                CategoryOrHttpMethod = null
            };

            var chains = new BehaviorChain[]{new BehaviorChain(),};

            search.FindForCategory(chains).Single().ShouldBeTheSameAs(chains.Single());
        }
开发者ID:DarthFubuMVC,项目名称:fubumvc,代码行数:11,代码来源:ChainSearchTester.cs


示例4: find_by_category_when_the_category_is_null_and_relaxed_search_and_only_one_chain_2

        public void find_by_category_when_the_category_is_null_and_relaxed_search_and_only_one_chain_2()
        {
            var search = new ChainSearch
            {
                CategoryMode = CategorySearchMode.Relaxed,
                CategoryOrHttpMethod = null
            };

            var chain1 = new RoutedChain("something");
            chain1.UrlCategory.Category = Categories.DEFAULT;

            var chains = new BehaviorChain[] { chain1, };

            search.FindForCategory(chains).Single().ShouldBeTheSameAs(chains.Single());
        }
开发者ID:DarthFubuMVC,项目名称:fubumvc,代码行数:15,代码来源:ChainSearchTester.cs


示例5: Find

        public BehaviorChain Find(Type handlerType, MethodInfo method, string category = null)
        {
            var search = new ChainSearch{
                Type = handlerType,
                TypeMode = TypeSearchMode.HandlerOnly,
                MethodName = method == null ? null : method.Name,
                CategoryOrHttpMethod = category
            };

            if (method == null)
            {
                search.TypeMode = TypeSearchMode.Any;
            }

            return Find(search);
        }
开发者ID:roend83,项目名称:fubumvc,代码行数:16,代码来源:ChainResolutionCache.cs


示例6: SetUp

        public void SetUp()
        {
            theServices = new InMemoryServiceLocator();
            theSearch = ChainSearch.ByUniqueInputType(typeof (object));
            theInput = new object();

            theResolver = MockRepository.GenerateStub<IChainResolver>();
            theUrlResolver = MockRepository.GenerateStub<IChainUrlResolver>();

            theChain = new BehaviorChain();

            theServices.Add(theResolver);
            theServices.Add(theUrlResolver);

            theRequest = new FormRequest(theSearch, theInput);
        }
开发者ID:joemcbride,项目名称:FubuMVC.Core.UI,代码行数:16,代码来源:FormRequestTester.cs


示例7: FindUnique

        public BehaviorChain FindUnique(object model, string category = null)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            var modelType = model.GetType();

            var search = new ChainSearch
            {
                Type = modelType, TypeMode = TypeSearchMode.InputModelOnly, CategoryOrHttpMethod = category
            };

            return Find(search);
        }
开发者ID:kingreatwill,项目名称:fubumvc,代码行数:16,代码来源:ChainResolutionCache.cs


示例8: find_by_category_relaxed_with_only_one_chain

        public void find_by_category_relaxed_with_only_one_chain()
        {
            var search = new ChainSearch
            {
                CategoryMode = CategorySearchMode.Relaxed,
                CategoryOrHttpMethod = "something"
            };

            var chain3 = new RoutedChain("")
            {
                UrlCategory =
                {
                    Category = null
                }
            };

            var chains = new BehaviorChain[] { chain3 };

            search.FindForCategory(chains).ShouldHaveTheSameElementsAs(chain3);
        }
开发者ID:joemcbride,项目名称:fubumvc,代码行数:20,代码来源:ChainSearchTester.cs


示例9: find_by_category_strict_with_multiple_chains_1

        public void find_by_category_strict_with_multiple_chains_1()
        {
            var search = new ChainSearch
            {
                CategoryMode = CategorySearchMode.Strict,
                CategoryOrHttpMethod = "something"
            };

            var chain1 = new RoutedChain("")
            {
                UrlCategory =
                {
                    Category = "something"
                }
            };

            var chain2 = new RoutedChain("")
            {
                UrlCategory =
                {
                    Category = Categories.DEFAULT
                }
            };

            var chain3 = new RoutedChain("")
            {
                UrlCategory =
                {
                    Category = null
                }
            };

            var chains = new BehaviorChain[] { chain1, chain2, chain3 };

            search.FindForCategory(chains).ShouldHaveTheSameElementsAs(chain1);
        }
开发者ID:joemcbride,项目名称:fubumvc,代码行数:36,代码来源:ChainSearchTester.cs


示例10: find_by_null_category_with_multiple_chains_but_only_one_is_default_3

        public void find_by_null_category_with_multiple_chains_but_only_one_is_default_3()
        {
            var search = new ChainSearch
            {
                CategoryMode = CategorySearchMode.Relaxed,
                CategoryOrHttpMethod = null
            };

            var chain1 = new RoutedChain("")
            {
                UrlCategory =
                {
                    Category = "something"
                }
            };

            var chain2 = new RoutedChain("")
            {
                UrlCategory =
                {
                    Category = Categories.DEFAULT
                }
            };

            var chain3 = new RoutedChain("")
            {
                UrlCategory =
                {
                    Category = Categories.DEFAULT
                }
            };

            var chains = new BehaviorChain[] { chain1, chain2, chain3 };

            search.FindForCategory(chains).ShouldHaveTheSameElementsAs(chain2, chain3);
        }
开发者ID:joemcbride,项目名称:fubumvc,代码行数:36,代码来源:ChainSearchTester.cs


示例11: FormRequest

 public FormRequest(ChainSearch search, object input)
 {
     _search = search;
     _input = input;
 }
开发者ID:kharlamov,项目名称:FubuMVC.Core.UI,代码行数:5,代码来源:FormRequest.cs


示例12: find

        private Func<BehaviorChain> find(ChainSearch search)
        {
            var candidates = search.FindCandidates(_behaviorGraph);

            var count = candidates.Count();
            switch (count)
            {
                case 1:
                    var chain = candidates.Single();
                    return () => chain;

                case 0:
                    return () =>
                    {
                        throw new FubuException(2104, "No behavior chains are registered matching criteria:  " + search);
                    };

                default:
                    var message = "More than one behavior chain matching criteria:  " + search;
                    message += "\nMatches:";

                    candidates.Each(x =>
                    {
                        // TODO -- BehaviorChain needs a Description or a better ToString()

                        var description = "\n";
                        if (x.Route != null)
                        {
                            description += x.Route.Pattern + "  ";
                        }

                        if (x.FirstCall() != null)
                        {
                            description += " -- " + x.FirstCall().Description;
                        }

                        message += description;
                    });

                    return () =>
                    {
                        throw new FubuException(2108, message);
                    };
            }
        }
开发者ID:jemacom,项目名称:fubumvc,代码行数:45,代码来源:ChainResolutionCache.cs


示例13: find_by_method_if_it_exists_2

        public void find_by_method_if_it_exists_2()
        {
            var candidates = new ChainSearch
            {
                TypeMode = TypeSearchMode.Any,
                Type = typeof(SimpleInputModel),
                MethodName = "Query"
            }.FindCandidatesByType(theGraph).SelectMany(x => x);

            candidates.Select(x => x.FirstCall().Description)
                .ShouldHaveTheSameElementsAs("OneController.Query(SimpleInputModel model) : SimpleOutputModel");
        }
开发者ID:joemcbride,项目名称:fubumvc,代码行数:12,代码来源:ChainSearchTester.cs


示例14: find_by_input_model_only

        public void find_by_input_model_only()
        {
            var chainSearch = new ChainSearch
                              {
                                  TypeMode = TypeSearchMode.InputModelOnly,
                                  Type = typeof(SimpleInputModel)
                              };

            chainSearch.FindCandidatesByType(theGraph).Single().Select(x => x.FirstCall().Description)
            .ShouldHaveTheSameElementsAs("OneController.Query(SimpleInputModel model) : SimpleOutputModel", "TwoController.NotQuery(SimpleInputModel model) : SimpleOutputModel");
        }
开发者ID:joemcbride,项目名称:fubumvc,代码行数:11,代码来源:ChainSearchTester.cs


示例15: FormRequest

 public FormRequest(ChainSearch search, object input) : this(search, input, false) { }
开发者ID:DarthFubuMVC,项目名称:FubuMVC.Core.UI,代码行数:1,代码来源:FormRequest.cs


示例16: FindUnique

        public BehaviorChain FindUnique(object model, string category = null)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            var forwarder = FindForwarder(model, category);
            if (forwarder != null)
            {
                return forwarder.FindChain(this, model).Chain;
            }

            var modelType = _typeResolver.ResolveType(model);

            var search = new ChainSearch
            {
                Type = modelType, TypeMode = TypeSearchMode.InputModelOnly, CategoryOrHttpMethod = category
            };

            return Find(search);
        }
开发者ID:NeilSorensen,项目名称:fubumvc,代码行数:22,代码来源:ChainResolutionCache.cs


示例17: find_by_any_looks_at_resource_model_first_then_handler_type_second

        public void find_by_any_looks_at_resource_model_first_then_handler_type_second()
        {
            var candidates = new ChainSearch
            {
                TypeMode = TypeSearchMode.ResourceModelOnly,
                Type = typeof(SimpleOutputModel)
            }.FindCandidatesByType(theGraph);

            candidates.First().Select(x => x.FirstCall().Description)
                .ShouldHaveTheSameElementsAs(
                "OneController.Report() : SimpleOutputModel",
                "OneController.Query(SimpleInputModel model) : SimpleOutputModel",
                "TwoController.Report() : SimpleOutputModel",
                "TwoController.NotQuery(SimpleInputModel model) : SimpleOutputModel"

                );
        }
开发者ID:joemcbride,项目名称:fubumvc,代码行数:17,代码来源:ChainSearchTester.cs


示例18: find_by_method_if_it_exists

        public void find_by_method_if_it_exists()
        {
            var candidates = new ChainSearch
            {
                TypeMode = TypeSearchMode.Any,
                Type = typeof(SimpleInputModel),
                MethodName = "DoSomething"
            }.FindCandidatesByType(theGraph).SelectMany(x => x);

            candidates.Any(x => x.FirstCall().Description == "SimpleInputModel.DoSomething(InputModel2 model) : void")
                .ShouldBeTrue();
        }
开发者ID:joemcbride,项目名称:fubumvc,代码行数:12,代码来源:ChainSearchTester.cs


示例19: find_by_category_strict_with_multiple_chains_by_method

        public void find_by_category_strict_with_multiple_chains_by_method()
        {
            var search = new ChainSearch
            {
                CategoryMode = CategorySearchMode.Strict,
                CategoryOrHttpMethod = "POST"
            };

            var chain1 = new BehaviorChain
            {
                Route = new RouteDefinition("whatever"),
                UrlCategory =
                {
                    Category = "something"
                }
            };

            chain1.Route.AllowedHttpMethods.Add("POST");

            var chain2 = new BehaviorChain
            {
                UrlCategory =
                {
                    Category = Categories.DEFAULT
                }
            };

            var chain3 = new BehaviorChain
            {
                UrlCategory =
                {
                    Category = null
                }
            };

            var chains = new BehaviorChain[] { chain1, chain2, chain3 };

            search.FindForCategory(chains).ShouldHaveTheSameElementsAs(chain1);
        }
开发者ID:roend83,项目名称:fubumvc,代码行数:39,代码来源:ChainSearchTester.cs


示例20: find_candidates_by_type_fall_back_to_handler_type_if_possible

        public void find_candidates_by_type_fall_back_to_handler_type_if_possible()
        {
            var chains = new ChainSearch{
                Type = typeof (SingleActionController),
                TypeMode = TypeSearchMode.Any
            }.FindCandidatesByType(theGraph).SelectMany(x => x);

            chains.Single()
                .FirstCall().Description.ShouldEqual("SingleActionController.DoSomething(InputModel model) : void");
        }
开发者ID:joemcbride,项目名称:fubumvc,代码行数:10,代码来源:ChainSearchTester.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Routes.RouteDefinition类代码示例发布时间:2022-05-26
下一篇:
C# Core.FubuRegistry类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap