/// <summary> /// The translate. /// </summary> /// <param name="request"> /// The request. /// </param> /// <param name="source"> /// The source. /// </param> /// <param name="destination"> /// The destination. /// </param> protected override void Translate(TranslateOrderToEntityRequest request, Order source, CommerceOrder destination) { base.Translate(request, source, destination); if ((source.Components == null) || !source.Components.Any()) { return; } // Sets all the properties from the custom components to the properties foreach (var component in source.Components) { foreach (var property in component.GetType().GetProperties()) { var name = component.GetType().Name + "_" + property.Name; if (property.GetValue(component) != null) { destination.Properties[name] = property.GetValue(component); } } } }
/// <summary>. /// Gets the translate destination. /// </summary> /// <param name="request">The request.</param> /// <returns>the destination CommerceConnect entity.</returns> protected override CommerceOrder GetTranslateDestination(TranslateOrderToEntityRequest request) { return(this.EntityFactory.Create <CommerceOrder>("Order")); }