介绍问题
我想实现果园以便为主要形状IShapeTableProvider,
添加替代品。List
我做了以下事情:
下载Orchard.Source.1.8.zip,在 VS 2013 中构建,并通过代码生成创建一个新主题:
orchard.exe
feature enable Orchard.CodeGeneration
codegen theme My.FirstTheme
theme enable My.FirstTheme
在 Themes > My.FirstTheme > Code > ListShapeProvider.cs 文件中将以下代码添加到我的主题中。
namespace Themes.My.FirstTheme.Code
{
using Orchard.Autoroute.Models;
using Orchard.ContentManagement;
using Orchard.DisplayManagement.Descriptors;
public class ListShapeProvider : IShapeTableProvider
{
public void Discover(ShapeTableBuilder builder)
{
System.Diagnostics.Debugger.Break(); // * not hit
}
}
}
清理并构建 Orchard 解决方案,然后调试 Orchard.Web。调试器未命中 System.Diagnostics.Debugger.Break()。
搜索和研究
我读过Orchard的仁慈独裁者的 Orchard shapeshifting。
此外,我已经安装、构建和运行 Contoso 主题作为IShapeTableProvider
. 的实现IShapeTableProvider
在 ContentShapeProvider.cs 文件中。Contoso 主题还包括一个 Contoso.csproj 文件,该文件将 ContentShapeProvider.cs 文件作为编译项。
<ItemGroup>
<Compile Include="Code\ContentShapeProvider.cs" />
</ItemGroup>
我创建的新主题没有 .csproj 文件。我认为丢失的 .csproj 文件解释了为什么我的 ListShapeProvider.cs 断点没有执行。
我应该为我的主题创建一个 .csproj 文件吗?是否有另一种推荐的方式在主题中包含 C#?例如,我应该使用 App_Code 文件夹吗?