Created
October 5, 2016 14:51
-
-
Save trnktms/c7ef5880a3fe44b7211aed82fae3f799 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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