我想在我现有的自定义模块中添加新的内容项。我想创建新表并管理新的内容项。我创建了新的 UpdateForm 方法,但是在启用或禁用模块时不会调用此方法。
public int UpdateForm2()
{
SchemaBuilder.CreateTable("SMRecord", table => table
.ContentPartRecord()
.Column<string>("Name", col => col.WithLength(250))
.Column<decimal>("week1", col => col.WithPrecision(18).WithScale(2))
.Column<decimal>("week2", col => col.WithPrecision(18).WithScale(2))
.Column<decimal>("week3", col => col.WithPrecision(18).WithScale(2))
.Column<int>("SPRecord_Id")
.Column<bool>("IsActive", col => col.WithDefault(true))
);
ContentDefinitionManager.AlterTypeDefinition("SM", builder => builder
.DisplayedAs("SM")
.WithPart("SMPart")
.WithPart("CommonPart")
.WithPart("IdentityPart")
);
ContentDefinitionManager.AlterPartDefinition(typeof(SMRecord).Name, cfg => cfg
.Attachable());
return 3;
}
但 UpdateForm2 没有调用。请帮助我如何调用 UpdateForm2 方法并升级我的模块版本。