0
我正在使用Glass映射器將Sitecore項目映射到類對象。即使傳遞null以通過控制器查看,模型仍具有值
在我將null傳遞給視圖的模塊之一中,該模型仍然有一個值。它似乎是繼承頁面屬性。以下是截圖。
Screen shot 2: Model in view still has a value
下面是Related_Content代碼由TDS產生:
/// <summary>
/// Related_Content
/// <para></para>
/// <para>Path: /sitecore/templates/User Defined/PokerCentral/Component Templates/Data Templates/Callouts/Related Content</para>
/// <para>ID: 2b54f9fd-1fb5-4638-98b0-0acd420c5b81</para>
/// </summary>
[SitecoreType(TemplateId=IRelated_ContentConstants.TemplateIdString)] //, Cachable = true
public partial class Related_Content : GlassBase, IRelated_Content
{
/// <summary>
/// The Item Listing field.
/// <para></para>
/// <para>Field Type: Treelist</para>
/// <para>Field ID: 7a77a177-c5e0-4f74-9235-c5c6b709f7a0</para>
/// <para>Custom Data: </para>
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Team Development for Sitecore - GlassItem.tt", "1.0")]
[SitecoreField(IRelated_ContentConstants.Item_ListingsFieldName)]
public virtual IEnumerable<Guid> Item_Listings {get; set;}
/// <summary>
/// The Title field.
/// <para></para>
/// <para>Field Type: Single-Line Text</para>
/// <para>Field ID: 5abe46db-487c-4f1b-8a3c-d3e0ed515d9c</para>
/// <para>Custom Data: </para>
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Team Development for Sitecore - GlassItem.tt", "1.0")]
[SitecoreField(IRelated_ContentConstants.TitleFieldName)]
public virtual string Title {get; set;}
/// <summary>
/// The Base Category field.
/// <para></para>
/// <para>Field Type: Droplink</para>
/// <para>Field ID: 1cb2b0a4-f7e7-4cbe-b49b-7d660106365a</para>
/// <para>Custom Data: </para>
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Team Development for Sitecore - GlassItem.tt", "1.0")]
[SitecoreField(IRelated_ContentConstants.Base_CategoryFieldName)]
public virtual Guid Base_Category {get; set;}
/// <summary>
/// The Base Tags field.
/// <para></para>
/// <para>Field Type: Multilist with Search</para>
/// <para>Field ID: 072c54de-8fde-47f8-aaa0-2b0b1bd8843b</para>
/// <para>Custom Data: </para>
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Team Development for Sitecore - GlassItem.tt", "1.0")]
[SitecoreField(IRelated_ContentConstants.Base_TagsFieldName)]
public virtual IEnumerable<Guid> Base_Tags {get; set;}
}
有人可以讓我知道我該怎麼解決這個問題?
您必須嘗試更改對象的名稱。我已經看到這個問題。映射做了一些不可思議的事情,也許試圖在某些緩存或類似的東西中獲取屬性的任何信息。 – dpfauwadel
我的案例中「Related_Content」的對象名是從TDS(團隊開發服務器)生成的。在這種情況下,如何更改名稱以及更多我們需要傳遞給查看的「Related_Content」類型的模型。 – Akhil
您可以發佈模式Related_Content的代碼嗎? –