Orchard CMS 1.8.1 - 迁移WithSetting not saving

时间:2015-07-16 00:00:16

标签: orchardcms orchardcms-1.8

我已经遵循了我创立的所有例子,但都没有。

我的代码(在Migrations.cs中)

.WithField("PeopleText", f => f
    .OfType("TextField")
    .WithDisplayName("People / Team"))

    //TODO: Not sure why these settings not taking effect!
    .WithSetting("TextFieldSettings.Flavor", "Html") 
    .WithSetting("TextFieldSettings.Required", "true")

以上2个设置均未保存

enter image description here

我不确定它是1.8.1版的已知错误还是我做了一些可怕的错误?

干杯,

1 个答案:

答案 0 :(得分:3)

您即将关闭字段迁移,这会导致.WithSetting链接到部分而不是字段:

.WithField("PeopleText", f => f
    .OfType("TextField")
    .WithDisplayName("People / Team")) // <-- here you close your field chain, so everything after this will attach to the part chain

如果将其更改为以下内容,则可以使用:

.WithField("PeopleText", f => f
    .OfType("TextField")
    .WithDisplayName("People / Team")

    .WithSetting("TextFieldSettings.Flavor", "Html") 
    .WithSetting("TextFieldSettings.Required", "true")) // Close field chain here