Skip to content

Instantly share code, notes, and snippets.

@trnktms
Created October 5, 2016 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trnktms/c7ef5880a3fe44b7211aed82fae3f799 to your computer and use it in GitHub Desktop.
Save trnktms/c7ef5880a3fe44b7211aed82fae3f799 to your computer and use it in GitHub Desktop.
using System;
using System.Data;
using Sitecore.Data;
using Sitecore.Data.Items;
namespace Sitecore.SharedSource.DataImporter.Providers
{
public class CustomSqlDataMap : Sitecore.SharedSource.DataImporter.Providers.SqlDataMap
{
public CustomSqlDataMap(Database db, string connectionString, Item importItem)
: base(db, connectionString, importItem)
{}
protected override string GetFieldValue(object importRow, string fieldName)
{
var item = importRow as DataRow;
var f = item[fieldName];
// it was the missing area because the default solution calls the .ToString()
// and if it's byte[] then I get "System.Byte[]"
var bytes = f as byte[];
if (bytes != null)
{
return Convert.ToBase64String(bytes);
}
return (f != null) ? f.ToString() : string.Empty;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment