Empty item name error when updating Sitecore item via Glass interface

217 views
Skip to first unread message

Dan Solovay

unread,
Oct 29, 2014, 12:29:56 PM10/29/14
to glasssite...@googlegroups.com
I am attempting to use the Sitecore Glass mapper (Glass.Mapper v 3.0.12.24 and Glass.Mapper.Sc v 3.2.1.42) to update a Sitecore item, and am receiving a Glass.Mapper.MapperException, "You can not set an empty or null Item name".  I have confirmed that the Name field is defined on the model, and is populated with the item name when the save method executes.

Additional details:
1. The model is defined as a C# interface.
2. The name field is defined as follows:
[SitecoreInfo(SitecoreInfoType.Name)]
string Name {get;}
3. The field being updated is a multilist, defined in the item as IList<Guid>
4. The item is retrieved using this code: 
SitecoreContext.GetItem<T>(
                path,
                isLazy: isLazy,
                inferType: inferType);
5. The item is saved with this:
SitecoreContext.Save<T>(glassItem)

6. This is the stack trace:

Glass.Mapper.Sc.DataMappers.SitecoreInfoMapper.MapToCms(AbstractDataMappingContext mappingContext)
   at Glass.Mapper.AbstractDataMapper.MapPropertyToCms(AbstractDataMappingContext mappingContext)
   at Glass.Mapper.Pipelines.ObjectSaving.Tasks.StandardSavingTask.<>c__DisplayClass1.<Execute>b__0(AbstractPropertyConfiguration x)
   at Glass.Mapper.ExtensionMethods.ForEach[T](IEnumerable`1 list, Action`1 action)
   at Glass.Mapper.Pipelines.ObjectSaving.Tasks.StandardSavingTask.Execute(ObjectSavingArgs args)
   at Glass.Mapper.Pipelines.AbstractPipelineRunner`2.Run(T args)
   at Glass.Mapper.AbstractService.SaveObject(AbstractTypeSavingContext abstractTypeSavingContext)
   at Glass.Mapper.Sc.SitecoreService.WriteToItem[T](T target, Item item, Boolean updateStatistics, Boolean silent)


Dan Solovay

unread,
Oct 29, 2014, 12:47:11 PM10/29/14
to glasssite...@googlegroups.com
Update. Adding a "set" to the property resolved the issue.
Reply all
Reply to author
Forward
0 new messages