1

I converted a site to Sitecore 9 and upgraded DEF from 1.4 to 2.0. I made the appropriate code changes from Adam Conn file based example.

But now when I debug the EventFieldValueAccessorConverter is hit, but my custom EventArrayValueReader is never called when the data is needed to be read. The only error is below and that is just an error that no object was passed into the next pipeline.

ManagedPoolThread #7 16:14:09 ERROR [Data Exchange] Pipeline step processing will abort because the identifier could not be resolved. (pipeline: Event Info from File to Event Info Item Sync Pipeline, pipeline step: Resolve Event Info Item, pipeline step identifier: 40570fc6-28d6-4fce-8420-b5febf4010fd)

ManagedPoolThread #7 16:14:09 ERROR [Data Exchange] Pipeline step processing will abort because no source object could be resolved from the pipeline context. (pipeline: Event Info from File to Event Info Item Sync Pipeline, pipeline step: Apply Mapping, pipeline step identifier: 8af58dcc-c5ed-4563-8de6-81d0b69be97f, target location: ec64487d-e7e6-40b0-a86c-40c74b95e04e)

I am lost on when or who executes the EventArrayValueReader.ReadResult() function, to diagnose this.

Value Accessor Converter

[SupportedIds(TemplateId)]
public class EventFieldValueAccessorConverter : ValueAccessorConverter
{
    public const string TemplateId = Templates.ArrayValueAccessor.ID;
    public const string TemplateFieldPosition = Templates.ArrayValueAccessor.Fields.FieldName;
    public EventFieldValueAccessorConverter(IItemModelRepository repository) : base(repository)
    {
    }
    protected override IValueReader GetValueReader(ItemModel source)
    {
        var reader = base.GetValueReader(source);
        if (reader == null)
        {
            var fieldName = this.GetStringValue(source, TemplateFieldPosition);

            reader = new EventArrayValueReader(fieldName);
        }
        return reader;
    }
    protected override IValueWriter GetValueWriter(ItemModel source)
    {
        var writer = base.GetValueWriter(source);
        if (writer == null)
        {
            var fieldName = this.GetStringValue(source, TemplateFieldPosition);

            writer = new PropertyValueWriter(fieldName);
        }
        return writer;
    }
}

IValueReader

public class EventArrayValueReader : IValueReader
{

    public readonly string FieldName;
    private readonly IEventsService eventsService;

    public bool UseValueProperty { get; set; }

    public EventArrayValueReader(string fieldName)
    {
        this.FieldName = fieldName;
        this.eventsService = DependencyResolver.Current.GetService<IEventsService>();
    }

    protected virtual bool CanRead(object source, DataAccessContext context)
    {
        bool flag = source != null && source is EventModel;
        return flag;
    }

    public virtual ReadResult Read(object source, DataAccessContext context)
    {
        var flag = false;
        object readValue = (object)null;
        var feeditem = source as EventModel;
        if (feeditem == null)
            return new ReadResult(DateTime.Now)
            {
                WasValueRead = flag,
                ReadValue = readValue
            };

        switch (this.FieldName)
        {
            case "ID":
                readValue = feeditem.ID;
                flag = true;
                break;
            case "MeetTitle":
                readValue = feeditem.MeetTitle;
                flag = true;
                break;

            default:
                Log.Info($"Missed field mapping {this.FieldName}", this);
                break;

        }

        return new ReadResult(DateTime.Now)
        {
            WasValueRead = flag,
            ReadValue = readValue
        };
    }
}
1

I worked with support on this and never was not able to resolve the issue. I ended up rebuilding the tenant, matching my values 1 for 1. After that it worked. There must be a difference between the 2.0 and 1.4 that we could not find.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.