---
title: "Implement a value accessor converter"
slug: "implement-a-value-accessor-converter"
abstract: "How to implement a value accessor converter to convert the item into a plugin in Sitecore Data Exchange Framework."
---
# Implement a value accessor converter

You must create a converter that can convert the settings on a value accessor item into a plugin. You can then specify the converter on the value accessor template in order to identify an endpoint for pipeline steps to read from.

To create the converter:

1. In Visual Studio, add the following class:

    ```csharp
    using Sitecore.DataExchange.Attributes;
    using Sitecore.DataExchange.Converters.DataAccess.ValueAccessors;
    using Sitecore.DataExchange.DataAccess;
    using Sitecore.DataExchange.DataAccess.Readers;
    using Sitecore.DataExchange.DataAccess.Writers;
    using Sitecore.DataExchange.Repositories;
    using Sitecore.Services.Core.Model;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace Examples.DataExchange.Providers.FileSystem
    {
        [SupportedIds(ArrayValueAccessorTemplateId)]
        public class ArrayValueAccessorConverter : ValueAccessorConverter
        {
            public const string ArrayValueAccessorTemplateId = "[ARRAY VALUE ACCESSOR TEMPLATE ID]";
            public const string TemplateFieldPosition = "Position";
            public ArrayValueAccessorConverter(IItemModelRepository repository) : base(repository)
            {
            }
            protected override IValueReader GetValueReader(ItemModel source)
            {
                var reader = base.GetValueReader(source);
                if (reader == null)
                {
                    var position = this.GetIntValue(source, TemplateFieldPosition);
                    if (position < 0)
                    {
                        return null;
                    }
                    reader = new ArrayValueReader(position);
                }
                return reader;
            }
            protected override IValueWriter GetValueWriter(ItemModel source)
            {
                var writer = base.GetValueWriter(source);
                if (writer == null)
                {
                    var position = this.GetIntValue(source, TemplateFieldPosition);
                    if (position < 0)
                    {
                        return null;
                    }
                    writer = new ArrayValueWriter(position);
                }
                return writer;
            }
        }
    }
    ```

    > [!important]
    > You must change the value of `[ARRAY VALUE ACCESSOR TEMPLATE ID]` to match the ID from the value accessor template named *Array Value Accessor* that you created in the [previous step](https://doc.sitecore.com/xp/en/developers/def/60/data-exchange-framework/create-a-template-for-value-accessors.html "Create a template for value accessors").

2. Compile the project.
3. Deploy `Examples.DataExchange.Providers.FileSystem.dll` to the Sitecore server.