Monaco LinkedList, AbstractSitecoreFieldMapper and Interfaces

169 views
Skip to first unread message

Chris Gaskell

unread,
Jul 7, 2014, 11:18:23 AM7/7/14
to glass...@googlegroups.com
Hey,

So I'm using interfaces to define my Cms entities as per http://glass.lu/docs/tutorial/sitecore/tutorial21/tutorial21.html and it's working brilliantly - being able to mirror the inheritance as per the model defined in Sitecore.

I've also installed the Monaco LinkedList http://code.monoco.se/2012/12/a-shiny-new-field-type-linklist/ and have had a look at Seans approach to mapping that list to IList<Link> http://www.seanholmesby.com/sitecore-glass-mapper-data-handler-for-a-link-list-field/

The difference between my approach and Seans is with the views, whereas Sean is pushing the mapped IList striaght to the view, mines a property on an interface which is instantiated within a controller. 

I currently have the property in the interface as 

  [SitecoreField(CustomFieldType = "LinkList")]
  IEnumerable<Link> LinkList1 { get; set; }

and have had a few other incarnations (with & without attribs etc).

I cant get past this error though, even though I can see the data from within the LinkedList field... any help much appreciated.

[NotImplementedException: The method or operation is not implemented.]
   Glass.Mapper.Sc.DataMappers.SitecoreFieldLinkMapper.GetFieldValue(String fieldValue, SitecoreFieldConfiguration config, SitecoreDataMappingContext context) +60
   Glass.Mapper.Sc.DataMappers.<>c__DisplayClass3.<GetFieldValue>b__1(String x) +129
   System.Linq.WhereSelectArrayIterator`2.MoveNext() +66
   System.Linq.Buffer`1..ctor(IEnumerable`1 source) +216
   System.Linq.Enumerable.ToArray(IEnumerable`1 source) +77
   Glass.Mapper.Sc.DataMappers.SitecoreFieldIEnumerableMapper.GetFieldValue(String fieldValue, SitecoreFieldConfiguration config, SitecoreDataMappingContext context) +523
   Glass.Mapper.Sc.DataMappers.AbstractSitecoreFieldMapper.GetField(Field field, SitecoreFieldConfiguration config, SitecoreDataMappingContext context) +104

[MapperException: Failed to map field LinkList1 with value <links><link text="Buying with us" linktype="anchor" anchor="#" title="Buying with us" class="" /><link text="Contact us" linktype="anchor" anchor="#" title="Contact us" class="" /><link text=" Media Centre" linktype="anchor" anchor="#" title=" Media Centre" class="" /></links>]
   Glass.Mapper.Sc.DataMappers.AbstractSitecoreFieldMapper.GetField(Field field, SitecoreFieldConfiguration config, SitecoreDataMappingContext context) +277
   Glass.Mapper.Sc.DataMappers.AbstractSitecoreFieldMapper.MapToProperty(AbstractDataMappingContext mappingContext) +228
   Glass.Mapper.Pipelines.ObjectConstruction.Tasks.CreateInterface.InterfacePropertyInterceptor.Intercept(IInvocation invocation) +368
   Castle.DynamicProxy.AbstractInvocation.Proceed() +108

Chris Gaskell

unread,
Jul 8, 2014, 2:48:11 AM7/8/14
to glass...@googlegroups.com
Not entirely sure how I've got this running!

I have changed the type in the mapper to IEnumerable<Link> and that's what's declared in my interfaces. I have also removed the [SitecoreField] attribute.

Fires up fine now.

Chris.

 
Reply all
Reply to author
Forward
0 new messages