Sitecore Glass Mapper always null

前端 未结 3 1877
广开言路
广开言路 2020-12-20 19:37

I am using Sitecore Glass Mapper for a new project I\'m setting up. We are using Sitecore 7.2, latest version of Team Development for Sitecore (TDS) code generation and the

3条回答
  •  离开以前
    2020-12-20 19:57

    Some things you may try (this didn't fit in the comments field)

    1) Confirm that the related fields in the Sitecore Item object contain values (so Sitecore.Context.Item for your "c" var and Sitecore.Context.Database.GetItem("path") for your "d" var)

    2) Try to encapsulate the GetItem/GetCurrentItem call in a VersionCountDisabler, like this:

    T01_Homepage model = null;
    
    using (new VersionCountDisabler())
    {
      var context = new SitecoreContext();
      model = context.GetItem("path");
    }
    
    // Do you have data in model now?
    

    3) Try to encapsulate the same call with a SecurityDisabler. Just to confirm it's not a security issue.

    4) If you still don't know what it is, please update your question with some (simplified) code for your model.

提交回复
热议问题