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


C# Template.BuildInstancePaths方法代码示例

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


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

示例1: SetUp

        public void SetUp()
        {
            var source1 = new TestSource
            {
                Name = "-artist-",
                GetAllItemsFunc = c => new[]
                {
                    new DynamicItem("beatles", new [] { new ContextItem("artist-id", "1") }),
                    new DynamicItem("beach-boys", new [] { new ContextItem("artist-id", "2") })
                }
            };

            var source2 = new TestSource
            {
                Name = "-album-",
                GetAllItemsFunc = c =>
                    {
                        return c.Any(i => i.Name == "artist-id" && i.Value == "1")
                        ? new[] { new DynamicItem("revolver") }
                        : new[] { new DynamicItem("pet-sounds") };
                    }
            };

            var dynamicSourceProvider = MockRepository.GenerateMock<IDynamicSourceProvider>();

            dynamicSourceProvider.Stub(p => p.Get("-artist-")).Return(source1);
            dynamicSourceProvider.Stub(p => p.Get("-album-")).Return(source2);
            var pathInstanceBuilder = new PathInstanceBuilder(dynamicSourceProvider);

            var template = new Template(new[] { "static", "-artist-", "-album-" });
            template.BuildInstancePaths(pathInstanceBuilder);

            this.resource = new TemplateResourceBuilder().Build(template) as TemplateResource;
        }
开发者ID:mr-sandy,项目名称:kola,代码行数:34,代码来源:WhenBuildingATemplateResourceForATemplateWithADynamicPath.cs

示例2: SetUp

        public void SetUp()
        {
            var dynamicSourceProvider = MockRepository.GenerateMock<IDynamicSourceProvider>();
            var pathInstanceBuilder = new PathInstanceBuilder(dynamicSourceProvider);

            var template = new Template(Enumerable.Empty<string>());
            template.BuildInstancePaths(pathInstanceBuilder);

            this.resource = new TemplateResourceBuilder().Build(template) as TemplateResource;
        }
开发者ID:mr-sandy,项目名称:kola,代码行数:10,代码来源:WhenBuildingATemplateResourceForTheHomepage.cs

示例3: CreateTemplate

        public IResult<Template> CreateTemplate(IEnumerable<string> rawPath)
        {
            var path = rawPath as string[] ?? rawPath.ToArray();

            var existingTemplate = this.contentRepository.GetTemplate(path);

            if (existingTemplate != null)
            {
                return new ConflictResult<Template>();
            }

            var template = new Template(path);

            this.contentRepository.Add(template);

            template.BuildInstancePaths(this.pathInstanceBuilder);

            return new CreatedResult<Template>(template);
        }
开发者ID:mr-sandy,项目名称:kola,代码行数:19,代码来源:TemplateService.cs

示例4: SetUp

        public void SetUp()
        {
            var dynamicSourceProvider = MockRepository.GenerateMock<IDynamicSourceProvider>();
            var pathInstanceBuilder = new PathInstanceBuilder(dynamicSourceProvider);

            var template = new Template(new[] { "test", "path" }, new IComponent[]
                {
                    new Atom("atom 0", new[]
                        {
                            new Property("property 0", "property 0 type", new FixedPropertyValue("property 0 value")),
                            new Property("property 1", "property 1 type", new InheritedPropertyValue("property 1 key")),
                        }),
                    new Container("container 1", components: new[] { new Atom("atom 1.0") }),
                    new Widget("widget 2", areas: new[] { new Area("area 1", new[] { new Atom("atom 2.0.0") }), })
                });

            template.BuildInstancePaths(pathInstanceBuilder);

            this.resource = new TemplateResourceBuilder().Build(template) as TemplateResource;
        }
开发者ID:mr-sandy,项目名称:kola,代码行数:20,代码来源:WhenBuildingATemplateResource.cs


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