2013-05-03 75 views
1

方案進行編輯設置果園自定義設置使用和部分

一個部分,一個不同的一部分消費設置

我下面這個幫助: http://docs.orchardproject.net/Documentation/Adding-custom-settings

對於設置部分沒有問題。

對於消費,如果未設置設置,我會返回自定義形狀而不是null。 這將是一個簡單的視圖,帶有一個鏈接邀請用戶轉到設置並在繼續之前正確設置它們。 注意:消費部分不是顯示器,而是編輯器......如果這很重要。

// Prevent share bar from showing if account is not set 
if (shareSettings == null || string.IsNullOrWhiteSpace(shareSettings.AddThisAccount)) { 
    return null; 
} 

現在我被困在寫什麼,而不是返回null。 我試圖做這樣的事情,但會記錄一個空引用。

return ContentShape("Parts_MyPart_SettingsMessage", 
     () => shapeHelper.Parts_MyPart_SettingsMessage()); 

任何幫助將不勝感激。

+0

您是否創建了視圖?你叫什麼了?它存儲在哪裏? – Hazza 2013-05-03 15:48:54

回答

1

我已經試過這樣:

return ContentShape("Parts_MyPart_SettingsMessage",() =>  
    shapeHelper.EditorTemplate(TemplateName: "Parts/MyPart.SettingsMessage")); 

,似乎它的作品...現在。我正在進一步調查爲什麼部分不是高負荷但有時只是...