我一直在爲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