2016-04-19 121 views
1

由於我一直在創建自己的Orchard模塊,因此我決定通過ContentDefinitionManager中的AlterPartDefinition方法(我一直關注Pluralsight上的Advanced Orchard課程),需要一些分類法。後來我決定我實際上不需要3個分類法,現在我想刪除其中的幾個。 下面是我添加它們的一些代碼。刪除遷移中的TaxonomyField

public int UpdateFrom10() 
     { 
      ContentDefinitionManager.AlterPartDefinition("ExercisePart", builder => 
      builder.WithField("Category", lvl => lvl.OfType("TaxonomyField") 
      .WithSetting("DisplayName", "Category") 
      .WithSetting("TaxonomyFieldSettings.Taxonomy", "Category") 
      .WithSetting("TaxonomyFieldSettings.LeavesOnly", "False") 
      .WithSetting("TaxonomyFieldSettings.SingleChoice", "False") 
      .WithSetting("TaxonomyFieldSettings.Hint", "Select the category") 
      )); 
      return 11; 
     } 

我該如何實現我的目標?

這是對於那些你訪問的過程中pluralsight https://app.pluralsight.com/library/courses/adv-orchard/table-of-contents

回答

4

很簡單

ContentDefinitionManager.AlterPartDefinition("ExercisePart", builder => 
     builder.RemoveField("Category")); 
+0

Syzmon,甜的感謝! –

+0

我的上帝,如果每次有人拼錯我的名字*,那麼*方式:) –

+0

哦對不起,男人,pfffft不得不再次檢查兩次hahaha Syzmon在我的大腦中更有意義。無論如何感謝Szymon :)。 –