<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title type="text">Blog posts by Yauheni Butsko</title><link href="http://world.optimizely.com" /><updated>2017-01-06T12:19:23.9500000Z</updated><id>https://world.optimizely.com/blogs/yauheni-butsko/</id> <generator uri="http://world.optimizely.com" version="2.0">Optimizely World</generator> <entry><title>How to export/import DDS items</title><link href="https://world.optimizely.com/blogs/yauheni-butsko/dates/2017/1/how-to-exportimport-dds/" /><id>&lt;p&gt;Episerver has functionality for export/import DDS items and use it for export/import property settings.&lt;/p&gt;
&lt;p&gt;This code shows how to export custom DDS types. You don&#39;t need to do anything for import.&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code&gt;using System;
using System.Linq;
using EPiServer.Core.Transfer;
using EPiServer.Data;
using EPiServer.Data.Dynamic;
using EPiServer.Enterprise;
using EPiServer.Framework;
using EPiServer.Framework.Initialization;

namespace DDSExport
{
    [InitializableModule]
    [ModuleDependency(typeof(EPiServer.Web.InitializationModule))]
    public class DDSExportInitialization : IInitializableModule
    {
        private readonly Type[] _typesToExport =
        {
            typeof(StoreType1), typeof(StoreType2)
        };

        public void Initialize(InitializationEngine context)
        {
            context.Locate.Advanced.GetInstance&amp;lt;IDataExportEvents&amp;gt;().ContentExporting += OnExporting;
        }

        public void Uninitialize(InitializationEngine context)
        {
            context.Locate.Advanced.GetInstance&amp;lt;IDataExportEvents&amp;gt;().ContentExporting -= OnExporting;
        }

        private void OnExporting(object sender, EventArgs e)
        {
            var exporter = (DataExporter) sender;
            if (exporter.TransferType == TypeOfTransfer.Exporting)
            {
                var ddsHandler = exporter.TransferHandlers.OfType&amp;lt;DynamicDataTransferHandler&amp;gt;().Single();

                foreach (var type in _typesToExport)
                {
                    var store = type.GetStore();
                    if (store == null)
                        continue;

                    foreach (var item in store.Items())
                        ddsHandler.AddToExport(item.GetIdentity().ExternalId, store.Name);
                }
            }
        }
    }
}&lt;/code&gt;&lt;/pre&gt;</id><updated>2017-01-06T12:19:23.9500000Z</updated><summary type="html">Blog post</summary></entry></feed>