我一直在为Orchard构建模块;基于N-N relationship tutorial。在我完成项目并改变名称空间之后,我开始了各种类和变量名称的工作,因为我对各种名称进行了各种不同的假设,而这些假设并没有出现。Orchard CMS模块仪表板中的重复模块条目
因为这个重命名行使模块( “定义列表”)两次显示了在模块仪表板:
这里是我的module.txt:
Name: Definition List AntiForgery: enabled Author: Richard Slater Website: http://www.richard-slater.co.uk/ Version: 0.2 OrchardVersion: 1.1 Description: Module Part to provision a selectable list of definitions as check boxes Features: Definition List: Description: Adds Definition List Part Category: Content
我可以”不要想到项目中会指定不同类别的任何地方。
Migrations.cs:
public class Migrations : DataMigrationImpl {
private readonly IRepository<DefinitionRecord> _definitionListRepository;
private readonly IEnumerable<DefinitionRecord> _sampleRecords = new List<DefinitionRecord> {
new DefinitionRecord { Term = "Term A", Definition = "This is the definition for Term A" },
new DefinitionRecord { Term = "Term B", Definition = "This is the definition for Term B" },
new DefinitionRecord { Term = "Term C", Definition = "This is the definition for Term C" }
};
public Migrations(IRepository<DefinitionRecord> definitionListRepository) {
_definitionListRepository = definitionListRepository;
}
public int Create()
{
SchemaBuilder.CreateTable("DefinitionListPartRecord",
table => table
.ContentPartRecord()
);
SchemaBuilder.CreateTable("DefinitionRecord",
table => table
.Column<int>("Id", column => column.PrimaryKey().Identity())
.Column<string>("Term")
.Column<string>("Definition")
);
SchemaBuilder.CreateTable("ContentDefinitionRecord",
table => table
.Column<int>("Id", column => column.PrimaryKey().Identity())
.Column<int>("DefinitionListPartRecord_Id")
.Column<int>("DefinitionRecord_Id")
);
ContentDefinitionManager.AlterPartDefinition(
"DefinitionListPart",
builder => builder.Attachable());
if (_definitionListRepository == null)
throw new InvalidOperationException("Cannot find the Definition List Repository");
foreach (var entity in _sampleRecords) {
_definitionListRepository.Create(entity);
}
return 1;
}
}
通过在“作者:Richard Slater”之后添加“Category:Content”,它现在在相同类别中出现两次,但我仍然不明白为什么Module和Feature显示为单独的项目。 – 2011-05-31 13:10:51