我有IShapeTableProvider
看起来像这样
public class ShapeProvider: Orchard.DisplayManagement.Descriptors.IShapeTableProvider
{
public void Discover(Orchard.DisplayManagement.Descriptors.ShapeTableBuilder aBuilder)
{
aBuilder.Describe("Parts_Container_Contained").OnDisplaying(c => OnShapeDisplaying(c));
}
private void OnShapeDisplaying(Orchard.DisplayManagement.Implementation.ShapeDisplayingContext aDisplayingContext)
{
...
aDisplayingContext.ShapeMetadata.Alternates.Add("Foo_Bar");
}
}
根据docs,备用形状名称Foo_Bar
已映射到Foo\Bar
,但永远不会呈现Bar
。而是使用默认形状。
甚至可以在子文件夹中发现形状替换?
修改
当我根据Parts.Container.Contained.cshtml
的请求重命名devqon
时,我得到以下异常
异常详细信息:Orchard.OrchardException:Formtyp Parts_Container_Contained nicht gefunden
来源错误:
第101行:抛出新的OrchardException(T(“找不到形状类型{0}”, shapeMetadata.Type));
源文件:
C:\项目\网络\ Intranet.NET \ SRC \果园\ DisplayManagement \实施\ DefaultDisplayManager.cs 行:101
堆栈追踪:
[OrchardException: Formtyp Parts_Container_Contained nicht gefunden]
Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Execute(DisplayContext context) in c:\Project\Web\Intranet.NET\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:101
Orchard.DisplayManagement.Implementation.DisplayHelper.ShapeExecute(Object shape) in c:\Project\Web\Intranet.NET\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:86
Orchard.DisplayManagement.Implementation.DisplayHelper.Invoke(String name, INamedEnumerable`1 parameters) in c:\Project\Web\Intranet.NET\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:44
Orchard.DisplayManagement.Implementation.DisplayHelper.TryInvoke(InvokeBinder binder, Object[] args, Object& result) in c:\Project\Web\Intranet.NET\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:29
CallSite.Target(Closure , CallSite , Object , Object ) +371
Orchard.Core.Shapes.CoreShapes.ContentZone(Object Display, Object Shape, TextWriter Output) in c:\Project\Web\Intranet.NET\src\Orchard.Web\Core\Shapes\CoreShapes.cs:286