public static LinkedInput MapFromDTO(string linkedInputDTO) { LinkedInput domain = new LinkedInput(); if (string.IsNullOrEmpty(linkedInputDTO)) { return(Empty()); } try { string[] array = linkedInputDTO.Split(','); if (array.Count() == 0) { domain = Empty(); } else if (array.Count() >= 10) { domain.SourceFieldType = Convert.ToInt32(array[0]).EnumValue <FieldTypeEnum>(); domain.SourceDataModelType = Convert.ToInt32(array[1]).EnumValue <DataModelTypeEnum>(); domain.SourceLinkFieldName = array[2]; domain.SourceLinkPrimitiveType = Convert.ToInt32(array[3]).EnumValue <PrimitiveTypeEnum>(); domain.TargetDataModelType = Convert.ToInt32(array[4]).EnumValue <DataModelTypeEnum>(); domain.TargetFieldType = Convert.ToInt32(array[5]).EnumValue <FieldTypeEnum>(); domain.TargetLinkFieldName = array[6]; domain.TargetLinkPrimitiveType = Convert.ToInt32(array[7]).EnumValue <PrimitiveTypeEnum>(); domain.TargetFieldName = array[8]; domain.TargetPrimitiveType = Convert.ToInt32(array[9]).EnumValue <PrimitiveTypeEnum>(); } } catch (Exception) { return(Empty()); } return(domain); }
public static string MapToDTO(LinkedInput linkedInput) { if (linkedInput == null) { return($""); } int sft = (int)linkedInput.SourceFieldType; int sdmt = (int)linkedInput.SourceDataModelType; string slfn = linkedInput.SourceLinkFieldName; int slpt = (int)linkedInput.SourceLinkPrimitiveType; int tgmt = (int)linkedInput.TargetDataModelType; int tft = (int)linkedInput.TargetFieldType; string tlfn = linkedInput.TargetLinkFieldName; int tlpt = (int)linkedInput.TargetLinkPrimitiveType; string tfn = linkedInput.TargetFieldName; int tpt = (int)linkedInput.TargetPrimitiveType; return($"{sft.ToString()},{sdmt.ToString()},{slfn},{slpt.ToString()},{tgmt.ToString()},{tft.ToString()},{tlfn},{tlpt.ToString()},{tfn},{tpt.ToString()}"); }
public static bool IsEmpty(LinkedInput linkedInput) => Object.Equals(Empty(), linkedInput);
public static DataModelTypeEnum GetTargetDataModelType(LinkedInput linkedInput) => linkedInput?.TargetDataModelType ?? DataModelTypeEnum.None;
public static DataModelTypeEnum GetSourceDataModelType(LinkedInput linkedInput) => linkedInput?.SourceDataModelType ?? DataModelTypeEnum.None;
public static FieldTypeEnum GetTargetFieldType(LinkedInput linkedInput) => linkedInput?.TargetFieldType ?? FieldTypeEnum.None;
public static FieldTypeEnum GetSourceFieldType(LinkedInput linkedInput) => linkedInput?.SourceFieldType ?? FieldTypeEnum.None;
public static PrimitiveTypeEnum GetTargetPrimitiveType(LinkedInput linkedInput) => linkedInput?.TargetPrimitiveType ?? PrimitiveTypeEnum.None;