0

We are using a repository to get Sitecore items from Solr and then map them to a Sitecore object using SitecoreContext.Map. Everything gets data except the Image property which is null.

The model is generate from TDS and the property is:

[SitecoreField(I_Base_Content_ItemConstants.ImageFieldName)] Glass.Mapper.Sc.Fields.Image Image {get; set;}

We are doing nothing custom.

Getting data from solr Mapping using SitecoreContext.Map Image property on our generated TDS class is Null

Thanks

Charlie

  • Is this an interface? – Michael Edwards Apr 22 '15 at 14:40
  • Can you check the following: The Field Name is correct, the image has been published, the field contains data, the field is of Image Field Type (not a drop link or similar). These are the most common problems. – Michael Edwards Apr 23 '15 at 12:58
  • Thanks Mike. The model is generated by TDS. Image is published and the field does contain data. So the class is a public partial class that inherits other templates. – Charlie Afford Apr 23 '15 at 13:23

2 Answers2

1

If you are using a TDS generated class make sure that you have this property on it:

        [TypeConverter(typeof(IndexFieldItemUriValueConverter))]
        [XmlIgnore]
        [IndexField("_uniqueid")]
        public virtual ItemUri Uri { get; set; }

Glass needs this to link the Solr item to the Sitecore item.

Michael Edwards
  • 6,308
  • 6
  • 44
  • 75
0

Mike it turned out to be because we were calling the map method and found the the id was property was empty. We fixed that by getting the value from sitecore and it worked :). Thanks.