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