Пример #1
0
        private ChoJSONWriter <T> WithField(string name, Type fieldType = null, ChoFieldValueTrimOption fieldValueTrimOption = ChoFieldValueTrimOption.Trim, string fieldName = null, Func <object, object> valueConverter = null,
                                            object defaultValue         = null, object fallbackValue = null, string fullyQualifiedMemberName = null, string formatText = null,
                                            string nullValue            = null)
        {
            if (!name.IsNullOrEmpty())
            {
                if (!_clearFields)
                {
                    ClearFields();
                    Configuration.MapRecordFields(Configuration.RecordType);
                }

                string fnTrim = name.NTrim();
                ChoJSONRecordFieldConfiguration fc = null;
                PropertyDescriptor pd = null;
                if (Configuration.JSONRecordFieldConfigurations.Any(o => o.Name == fnTrim))
                {
                    fc = Configuration.JSONRecordFieldConfigurations.Where(o => o.Name == fnTrim).First();
                    Configuration.JSONRecordFieldConfigurations.Remove(fc);
                }
                else
                {
                    pd = ChoTypeDescriptor.GetNestedProperty(typeof(T), fullyQualifiedMemberName.IsNullOrWhiteSpace() ? name : fullyQualifiedMemberName);
                }

                var nfc = new ChoJSONRecordFieldConfiguration(fnTrim, (string)null)
                {
                    FieldType            = fieldType,
                    FieldValueTrimOption = fieldValueTrimOption,
                    FieldName            = fieldName,
                    ValueConverter       = valueConverter,
                    DefaultValue         = defaultValue,
                    FallbackValue        = fallbackValue,
                    FormatText           = formatText,
                    NullValue            = nullValue
                };
                if (fullyQualifiedMemberName.IsNullOrWhiteSpace())
                {
                    nfc.PropertyDescriptor = fc != null ? fc.PropertyDescriptor : pd;
                    nfc.DeclaringMember    = fc != null ? fc.DeclaringMember : fullyQualifiedMemberName;
                }
                else
                {
                    pd = ChoTypeDescriptor.GetNestedProperty(typeof(T), fullyQualifiedMemberName);
                    nfc.PropertyDescriptor = pd;
                    nfc.DeclaringMember    = fullyQualifiedMemberName;
                }
                if (pd != null)
                {
                    if (nfc.FieldType == null)
                    {
                        nfc.FieldType = pd.PropertyType;
                    }
                }

                Configuration.JSONRecordFieldConfigurations.Add(nfc);
            }

            return(this);
        }
Пример #2
0
        private ChoXmlWriter <T> WithField(string name, string xPath = null, Type fieldType       = null, ChoFieldValueTrimOption fieldValueTrimOption = ChoFieldValueTrimOption.Trim,
                                           bool isXmlAttribute       = false, bool isAnyXmlNode   = false, string fieldName = null, Func <object, object> valueConverter = null, bool isNullable   = false,
                                           object defaultValue       = null, object fallbackValue = null, bool encodeValue  = true, string fullyQualifiedMemberName      = null, string formatText = null)
        {
            if (!name.IsNullOrEmpty())
            {
                if (!_clearFields)
                {
                    ClearFields();
                    Configuration.MapRecordFields(Configuration.RecordType);
                }

                string fnTrim = name.NTrim();
                ChoXmlRecordFieldConfiguration fc = null;
                PropertyDescriptor             pd = null;
                xPath = xPath.IsNullOrWhiteSpace() ? $"//{fnTrim}" : xPath;

                if (Configuration.XmlRecordFieldConfigurations.Any(o => o.Name == fnTrim))
                {
                    fc = Configuration.XmlRecordFieldConfigurations.Where(o => o.Name == fnTrim).First();
                    Configuration.XmlRecordFieldConfigurations.Remove(fc);
                }
                else
                {
                    pd = ChoTypeDescriptor.GetNestedProperty(typeof(T), fullyQualifiedMemberName.IsNullOrWhiteSpace() ? name : fullyQualifiedMemberName);
                }

                var nfc = new ChoXmlRecordFieldConfiguration(fnTrim, xPath)
                {
                    FieldType            = fieldType,
                    FieldValueTrimOption = fieldValueTrimOption,
                    IsXmlAttribute       = isXmlAttribute,
                    FieldName            = fieldName,
                    ValueConverter       = valueConverter,
                    IsNullable           = isNullable,
                    DefaultValue         = defaultValue,
                    FallbackValue        = fallbackValue,
                    EncodeValue          = encodeValue,
                    FormatText           = formatText,
                    IsAnyXmlNode         = isAnyXmlNode
                };

                if (fullyQualifiedMemberName.IsNullOrWhiteSpace())
                {
                    nfc.PropertyDescriptor = fc != null ? fc.PropertyDescriptor : pd;
                    nfc.DeclaringMember    = fc != null ? fc.DeclaringMember : fullyQualifiedMemberName;
                }
                else
                {
                    pd = ChoTypeDescriptor.GetNestedProperty(typeof(T), fullyQualifiedMemberName);
                    nfc.PropertyDescriptor = pd;
                    nfc.DeclaringMember    = fullyQualifiedMemberName;
                }

                Configuration.XmlRecordFieldConfigurations.Add(nfc);
            }

            return(this);
        }
Пример #3
0
        private ChoCSVWriter <T> WithField(string name, Type fieldType = null, bool?quoteField = null, char?fillChar = null,
                                           ChoFieldValueJustification?fieldValueJustification = null,
                                           bool?truncate = null, string fieldName = null, int?fieldPosition = null,
                                           Func <object, object> valueConverter = null,
                                           Func <dynamic, object> valueSelector = null,
                                           Func <string> headerSelector         = null,
                                           object defaultValue             = null, object fallbackValue = null,
                                           string fullyQualifiedMemberName = null, string formatText    = null, string nullValue = null,
                                           bool excelField = false)
        {
            if (!name.IsNullOrEmpty())
            {
                if (!_clearFields)
                {
                    ClearFields();
                    Configuration.MapRecordFields(Configuration.RecordType);
                }
                if (fieldName.IsNullOrWhiteSpace())
                {
                    fieldName = name;
                }

                string fnTrim = name.NTrim();
                ChoCSVRecordFieldConfiguration fc = null;
                PropertyDescriptor             pd = null;
                //if (Configuration.CSVRecordFieldConfigurations.Any(o => o.Name == fnTrim))
                //{
                if (fullyQualifiedMemberName != null)
                {
                    fc = Configuration.CSVRecordFieldConfigurations.Where(o => o.DeclaringMember == fullyQualifiedMemberName).FirstOrDefault();
                }
                else
                {
                    fc = Configuration.CSVRecordFieldConfigurations.Where(o => o.Name == fnTrim).FirstOrDefault();
                }

                if (fc != null && fieldPosition == null)
                {
                    fieldPosition = fc.FieldPosition;
                }

                //Configuration.CSVRecordFieldConfigurations.Remove(fc);
                //}
                if (fc == null)
                {
                    pd = ChoTypeDescriptor.GetNestedProperty(typeof(T), fullyQualifiedMemberName.IsNullOrWhiteSpace() ? name : fullyQualifiedMemberName);
                    if (fieldPosition == null)
                    {
                        fieldPosition = Configuration.CSVRecordFieldConfigurations.Count > 0 ? Configuration.CSVRecordFieldConfigurations.Max(f => f.FieldPosition) : 0;
                        fieldPosition++;
                    }
                }

                ChoCSVRecordFieldConfiguration nfc = null;
                if (fc != null)
                {
                    nfc = fc;

                    if (fieldType != null)
                    {
                        nfc.FieldType = fieldType;
                    }
                    if (quoteField != null)
                    {
                        nfc.QuoteField = quoteField;
                    }
                    if (fillChar != null)
                    {
                        nfc.FillChar = fillChar;
                    }
                    if (fieldValueJustification != null)
                    {
                        nfc.FieldValueJustification = fieldValueJustification;
                    }
                    if (truncate != null)
                    {
                        nfc.Truncate = truncate.Value;
                    }
                    if (fieldName != null)
                    {
                        nfc.FieldName = fieldName;
                    }
                    if (valueConverter != null)
                    {
                        nfc.ValueConverter = valueConverter;
                    }
                    if (valueSelector != null)
                    {
                        nfc.ValueSelector = valueSelector;
                    }
                    if (headerSelector != null)
                    {
                        nfc.HeaderSelector = headerSelector;
                    }
                    if (defaultValue != null)
                    {
                        nfc.DefaultValue = defaultValue;
                    }
                    if (fallbackValue != null)
                    {
                        nfc.FallbackValue = fallbackValue;
                    }
                    if (formatText != null)
                    {
                        nfc.FormatText = formatText;
                    }
                    if (nullValue != null)
                    {
                        nfc.NullValue = nullValue;
                    }
                    nfc.ExcelField = excelField;
                }
                else
                {
                    nfc = new ChoCSVRecordFieldConfiguration(fnTrim, fieldPosition.Value)
                    {
                        FieldType  = fieldType,
                        QuoteField = quoteField,
                        FillChar   = fillChar,
                        FieldValueJustification = fieldValueJustification,
                        Truncate       = truncate != null ? truncate.Value : true,
                        FieldName      = fieldName,
                        ValueConverter = valueConverter,
                        ValueSelector  = valueSelector,
                        HeaderSelector = headerSelector,
                        DefaultValue   = defaultValue,
                        FallbackValue  = fallbackValue,
                        FormatText     = formatText,
                        NullValue      = nullValue,
                        ExcelField     = excelField
                    };
                    if (fullyQualifiedMemberName.IsNullOrWhiteSpace())
                    {
                        nfc.PropertyDescriptor = fc != null ? fc.PropertyDescriptor : pd;
                        nfc.DeclaringMember    = fc != null ? fc.DeclaringMember : fullyQualifiedMemberName;
                    }
                    else
                    {
                        pd = ChoTypeDescriptor.GetNestedProperty(typeof(T), fullyQualifiedMemberName);
                        nfc.PropertyDescriptor = pd;
                        nfc.DeclaringMember    = fullyQualifiedMemberName;
                    }
                    if (pd != null)
                    {
                        if (nfc.FieldType == null)
                        {
                            nfc.FieldType = pd.PropertyType;
                        }
                    }

                    Configuration.CSVRecordFieldConfigurations.Add(nfc);
                }
            }

            return(this);
        }
Пример #4
0
        private ChoFixedLengthWriter <T> WithField(string name, int startIndex, int size, Type fieldType = null, bool?quoteField = null, char?fillChar = null, ChoFieldValueJustification?fieldValueJustification = null,
                                                   bool truncate = true, string fieldName = null, Func <object, object> valueConverter = null,
                                                   Func <dynamic, object> valueSelector = null,
                                                   object defaultValue             = null, object fallbackValue = null,
                                                   string fullyQualifiedMemberName = null, string formatText    = null, string nullValue = null)
        {
            if (!name.IsNullOrEmpty())
            {
                if (!_clearFields)
                {
                    ClearFields();
                    Configuration.MapRecordFields(Configuration.RecordType);
                }
                if (fieldName.IsNullOrWhiteSpace())
                {
                    fieldName = name;
                }

                string fnTrim = name.NTrim();
                ChoFixedLengthRecordFieldConfiguration fc = null;
                PropertyDescriptor pd = null;
                if (Configuration.FixedLengthRecordFieldConfigurations.Any(o => o.Name == fnTrim))
                {
                    fc = Configuration.FixedLengthRecordFieldConfigurations.Where(o => o.Name == fnTrim).First();
                    Configuration.FixedLengthRecordFieldConfigurations.Remove(fc);
                }
                else
                {
                    pd = ChoTypeDescriptor.GetNestedProperty(typeof(T), fullyQualifiedMemberName.IsNullOrWhiteSpace() ? name : fullyQualifiedMemberName);
                }

                var nfc = new ChoFixedLengthRecordFieldConfiguration(name.Trim(), startIndex, size)
                {
                    FieldType  = fieldType,
                    QuoteField = quoteField,
                    FillChar   = fillChar,
                    FieldValueJustification = fieldValueJustification,
                    Truncate       = truncate,
                    FieldName      = fieldName.IsNullOrWhiteSpace() ? name : fieldName,
                    ValueConverter = valueConverter,
                    ValueSelector  = valueSelector,
                    DefaultValue   = defaultValue,
                    FallbackValue  = fallbackValue,
                    FormatText     = formatText,
                    NullValue      = nullValue
                };

                if (fullyQualifiedMemberName.IsNullOrWhiteSpace())
                {
                    nfc.PropertyDescriptor = fc != null ? fc.PropertyDescriptor : pd;
                    nfc.DeclaringMember    = fc != null ? fc.DeclaringMember : fullyQualifiedMemberName;
                }
                else
                {
                    pd = ChoTypeDescriptor.GetNestedProperty(typeof(T), fullyQualifiedMemberName);
                    nfc.PropertyDescriptor = pd;
                    nfc.DeclaringMember    = fullyQualifiedMemberName;
                }
                if (pd != null)
                {
                    if (nfc.FieldType == null)
                    {
                        nfc.FieldType = pd.PropertyType;
                    }
                }

                Configuration.FixedLengthRecordFieldConfigurations.Add(nfc);
            }

            return(this);
        }
Пример #5
0
        private ChoJSONReader <T> WithField(string name, string jsonPath           = null, Type fieldType = null, ChoFieldValueTrimOption fieldValueTrimOption = ChoFieldValueTrimOption.Trim, bool isJSONAttribute = false, string fieldName = null, Func <object, object> valueConverter = null,
                                            Func <object, object> itemConverter    = null,
                                            Func <object, object> customSerializer = null,
                                            object defaultValue = null, object fallbackValue = null, string fullyQualifiedMemberName = null,
                                            string formatText   = null, bool isArray         = true, string nullValue = null,
                                            Type recordType     = null, Func <JObject, Type> fieldTypeSelector = null)
        {
            if (!name.IsNullOrEmpty())
            {
                if (!_clearFields)
                {
                    ClearFields();
                    Configuration.MapRecordFields(Configuration.RecordType);
                }
                if (recordType != null)
                {
                    Configuration.MapRecordFieldsForType(recordType);
                }

                string fnTrim = name.NTrim();
                ChoJSONRecordFieldConfiguration fc = null;
                PropertyDescriptor pd = null;
                if (Configuration.JSONRecordFieldConfigurations.Any(o => o.Name == fnTrim))
                {
                    fc = Configuration.JSONRecordFieldConfigurations.Where(o => o.Name == fnTrim).First();
                    Configuration.JSONRecordFieldConfigurations.Remove(fc);
                }
                else if (recordType != null)
                {
                    pd = ChoTypeDescriptor.GetNestedProperty(recordType, fullyQualifiedMemberName.IsNullOrWhiteSpace() ? name : fullyQualifiedMemberName);
                }
                else
                {
                    pd = ChoTypeDescriptor.GetNestedProperty(typeof(T), fullyQualifiedMemberName.IsNullOrWhiteSpace() ? name : fullyQualifiedMemberName);
                }

                var nfc = new ChoJSONRecordFieldConfiguration(fnTrim, jsonPath)
                {
                    FieldType            = fieldType,
                    FieldValueTrimOption = fieldValueTrimOption,
                    FieldName            = fieldName,
                    ValueConverter       = valueConverter,
                    CustomSerializer     = customSerializer,
                    DefaultValue         = defaultValue,
                    FallbackValue        = fallbackValue,
                    FormatText           = formatText,
                    ItemConverter        = itemConverter,
                    IsArray           = isArray,
                    NullValue         = nullValue,
                    FieldTypeSelector = fieldTypeSelector,
                };
                if (fullyQualifiedMemberName.IsNullOrWhiteSpace())
                {
                    nfc.PropertyDescriptor = fc != null ? fc.PropertyDescriptor : pd;
                    nfc.DeclaringMember    = fc != null ? fc.DeclaringMember : fullyQualifiedMemberName;
                }
                else
                {
                    if (recordType == null)
                    {
                        pd = ChoTypeDescriptor.GetNestedProperty(typeof(T), fullyQualifiedMemberName);
                    }
                    else
                    {
                        pd = ChoTypeDescriptor.GetNestedProperty(recordType, fullyQualifiedMemberName);
                    }

                    nfc.PropertyDescriptor = pd;
                    nfc.DeclaringMember    = fullyQualifiedMemberName;
                }
                if (pd != null)
                {
                    if (nfc.FieldType == null)
                    {
                        nfc.FieldType = pd.PropertyType;
                    }
                }

                if (recordType == null)
                {
                    Configuration.JSONRecordFieldConfigurations.Add(nfc);
                }
                else
                {
                    Configuration.Add(recordType, nfc);
                }
            }

            return(this);
        }
Пример #6
0
        internal void WithField(string name, string YamlPath           = null, Type fieldType = null, ChoFieldValueTrimOption fieldValueTrimOption = ChoFieldValueTrimOption.Trim, string fieldName = null, Func <object, object> valueConverter = null,
                                Func <object, object> itemConverter    = null,
                                Func <object, object> customSerializer = null,
                                object defaultValue = null, object fallbackValue = null, string fullyQualifiedMemberName = null,
                                string formatText   = null, bool isArray         = true, string nullValue = null, Type recordType = null,
                                Type subRecordType  = null, Func <IDictionary <string, object>, Type> fieldTypeSelector = null)
        {
            ChoGuard.ArgumentNotNull(recordType, nameof(recordType));

            if (!name.IsNullOrEmpty())
            {
                if (subRecordType != null)
                {
                    MapRecordFieldsForType(subRecordType);
                }

                string fnTrim = name.NTrim();
                ChoYamlRecordFieldConfiguration fc = null;
                PropertyDescriptor pd = null;
                if (YamlRecordFieldConfigurations.Any(o => o.Name == fnTrim))
                {
                    fc = YamlRecordFieldConfigurations.Where(o => o.Name == fnTrim).First();
                    YamlRecordFieldConfigurations.Remove(fc);
                }
                else if (subRecordType != null)
                {
                    pd = ChoTypeDescriptor.GetNestedProperty(subRecordType, fullyQualifiedMemberName.IsNullOrWhiteSpace() ? name : fullyQualifiedMemberName);
                }
                else
                {
                    pd = ChoTypeDescriptor.GetNestedProperty(recordType, fullyQualifiedMemberName.IsNullOrWhiteSpace() ? name : fullyQualifiedMemberName);
                }

                var nfc = new ChoYamlRecordFieldConfiguration(fnTrim, YamlPath)
                {
                    FieldType            = fieldType,
                    FieldValueTrimOption = fieldValueTrimOption,
                    FieldName            = fieldName.IsNullOrWhiteSpace() ? name : fieldName,
                    ValueConverter       = valueConverter,
                    CustomSerializer     = customSerializer,
                    DefaultValue         = defaultValue,
                    FallbackValue        = fallbackValue,
                    FormatText           = formatText,
                    ItemConverter        = itemConverter,
                    IsArray           = isArray,
                    NullValue         = nullValue,
                    FieldTypeSelector = fieldTypeSelector,
                };
                if (fullyQualifiedMemberName.IsNullOrWhiteSpace())
                {
                    nfc.PropertyDescriptor = fc != null ? fc.PropertyDescriptor : pd;
                    nfc.DeclaringMember    = fc != null ? fc.DeclaringMember : fullyQualifiedMemberName;
                }
                else
                {
                    if (subRecordType == null)
                    {
                        pd = ChoTypeDescriptor.GetNestedProperty(recordType, fullyQualifiedMemberName);
                    }
                    else
                    {
                        pd = ChoTypeDescriptor.GetNestedProperty(subRecordType, fullyQualifiedMemberName);
                    }

                    nfc.PropertyDescriptor = pd;
                    nfc.DeclaringMember    = fullyQualifiedMemberName;
                }
                if (pd != null)
                {
                    if (nfc.FieldType == null)
                    {
                        nfc.FieldType = pd.PropertyType;
                    }
                }

                if (subRecordType == null)
                {
                    YamlRecordFieldConfigurations.Add(nfc);
                }
                else
                {
                    AddFieldForType(subRecordType, nfc);
                }
            }
        }
Пример #7
0
        private ChoCSVReader <T> WithField(string name, int?position, Type fieldType    = null, bool?quoteField = null,
                                           ChoFieldValueTrimOption fieldValueTrimOption = ChoFieldValueTrimOption.Trim, string fieldName = null,
                                           Func <object, object> valueConverter         = null,
                                           Func <dynamic, object> valueSelector         = null,
                                           object defaultValue             = null, object fallbackValue = null, string altFieldNames = null,
                                           string fullyQualifiedMemberName = null, string formatText    = null,
                                           string nullValue = null)
        {
            if (!name.IsNullOrEmpty())
            {
                if (!_clearFields)
                {
                    ClearFields();
                    Configuration.MapRecordFields(Configuration.RecordType);
                }
                if (fieldName.IsNullOrWhiteSpace())
                {
                    fieldName = name;
                }

                string fnTrim = name.NTrim();
                ChoCSVRecordFieldConfiguration fc = null;
                PropertyDescriptor             pd = null;
                if (Configuration.CSVRecordFieldConfigurations.Any(o => o.Name == fnTrim))
                {
                    fc = Configuration.CSVRecordFieldConfigurations.Where(o => o.Name == fnTrim).First();
                    if (position == null)
                    {
                        position = fc.FieldPosition;
                    }

                    Configuration.CSVRecordFieldConfigurations.Remove(fc);
                }
                else
                {
                    pd       = ChoTypeDescriptor.GetNestedProperty(typeof(T), fullyQualifiedMemberName.IsNullOrWhiteSpace() ? name : fullyQualifiedMemberName);
                    position = Configuration.CSVRecordFieldConfigurations.Count > 0 ? Configuration.CSVRecordFieldConfigurations.Max(f => f.FieldPosition) : 0;
                    position++;
                }

                var nfc = new ChoCSVRecordFieldConfiguration(fnTrim, position.Value)
                {
                    FieldType            = fieldType,
                    QuoteField           = quoteField,
                    FieldValueTrimOption = fieldValueTrimOption,
                    FieldName            = fieldName,
                    ValueConverter       = valueConverter,
                    ValueSelector        = valueSelector,
                    DefaultValue         = defaultValue,
                    FallbackValue        = fallbackValue,
                    AltFieldNames        = altFieldNames,
                    FormatText           = formatText,
                    NullValue            = nullValue
                };
                if (fullyQualifiedMemberName.IsNullOrWhiteSpace())
                {
                    nfc.PropertyDescriptor = fc != null ? fc.PropertyDescriptor : pd;
                    nfc.DeclaringMember    = fc != null ? fc.DeclaringMember : fullyQualifiedMemberName;
                }
                else
                {
                    pd = ChoTypeDescriptor.GetNestedProperty(typeof(T), fullyQualifiedMemberName);
                    nfc.PropertyDescriptor = pd;
                    nfc.DeclaringMember    = fullyQualifiedMemberName;
                }
                if (pd != null)
                {
                    if (nfc.FieldType == null)
                    {
                        nfc.FieldType = pd.PropertyType;
                    }
                }

                Configuration.CSVRecordFieldConfigurations.Add(nfc);
            }

            return(this);
        }
Пример #8
0
        internal void WithField(string name, string jsonPath           = null, Type fieldType = null, ChoFieldValueTrimOption fieldValueTrimOption = ChoFieldValueTrimOption.Trim, string fieldName = null, Func <object, object> valueConverter = null,
                                Func <object, object> itemConverter    = null,
                                Func <object, object> customSerializer = null,
                                object defaultValue = null, object fallbackValue = null, string fullyQualifiedMemberName = null,
                                string formatText   = null, bool?isArray         = null, string nullValue = null, Type recordType = null,
                                Type subRecordType  = null, Func <JObject, Type> fieldTypeSelector = null)
        {
            ChoGuard.ArgumentNotNull(recordType, nameof(recordType));

            if (!name.IsNullOrEmpty())
            {
                if (subRecordType != null)
                {
                    MapRecordFieldsForType(subRecordType);
                }

                string fnTrim = fieldName.IsNullOrWhiteSpace() ? name.NTrim() : fieldName;
                ChoJSONRecordFieldConfiguration fc = null;
                PropertyDescriptor pd = null;
                if (JSONRecordFieldConfigurations.Any(o => o.FieldName == fnTrim))
                {
                    fc = JSONRecordFieldConfigurations.Where(o => o.FieldName == fnTrim).First();
                    JSONRecordFieldConfigurations.Remove(fc);
                    pd = ChoTypeDescriptor.GetNestedProperty(recordType, fullyQualifiedMemberName.IsNullOrWhiteSpace() ? name : fullyQualifiedMemberName);
                }
                else if (subRecordType != null)
                {
                    pd = ChoTypeDescriptor.GetNestedProperty(subRecordType, fullyQualifiedMemberName.IsNullOrWhiteSpace() ? name : fullyQualifiedMemberName);
                }
                else
                {
                    pd = ChoTypeDescriptor.GetNestedProperty(recordType, fullyQualifiedMemberName.IsNullOrWhiteSpace() ? name : fullyQualifiedMemberName);
                }

                var nfc = new ChoJSONRecordFieldConfiguration(fnTrim, pd != null ? ChoTypeDescriptor.GetPropetyAttribute <ChoJSONRecordFieldAttribute>(pd) : null,
                                                              pd != null ? pd.Attributes.OfType <Attribute>().ToArray() : null)
                {
                };
                nfc.JSONPath             = !jsonPath.IsNullOrWhiteSpace() ? jsonPath : nfc.JSONPath;
                nfc.FieldType            = fieldType != null ? fieldType : nfc.FieldType;
                nfc.FieldValueTrimOption = fieldValueTrimOption;
                nfc.FieldName            = fieldName.IsNullOrWhiteSpace() ? (name.IsNullOrWhiteSpace() ? nfc.FieldName : name) : fieldName;
                nfc.ValueConverter       = valueConverter != null ? valueConverter : nfc.ValueConverter;
                nfc.CustomSerializer     = customSerializer != null ? customSerializer : nfc.CustomSerializer;
                nfc.DefaultValue         = defaultValue != null ? defaultValue : nfc.DefaultValue;
                nfc.FallbackValue        = fallbackValue != null ? fallbackValue : nfc.FallbackValue;
                nfc.FormatText           = !formatText.IsNullOrWhiteSpace() ? formatText : nfc.FormatText;
                nfc.ItemConverter        = itemConverter != null ? itemConverter : nfc.ItemConverter;
                nfc.IsArray           = isArray != null ? isArray : nfc.IsArray;
                nfc.NullValue         = !nullValue.IsNullOrWhiteSpace() ? nullValue : nfc.NullValue;
                nfc.FieldTypeSelector = fieldTypeSelector != null ? fieldTypeSelector : nfc.FieldTypeSelector;

                if (fullyQualifiedMemberName.IsNullOrWhiteSpace())
                {
                    nfc.PropertyDescriptor = fc != null ? fc.PropertyDescriptor : pd;
                    nfc.DeclaringMember    = fc != null ? fc.DeclaringMember : fullyQualifiedMemberName;
                }
                else
                {
                    if (subRecordType == null)
                    {
                        pd = ChoTypeDescriptor.GetNestedProperty(recordType, fullyQualifiedMemberName);
                    }
                    else
                    {
                        pd = ChoTypeDescriptor.GetNestedProperty(subRecordType, fullyQualifiedMemberName);
                    }

                    nfc.PropertyDescriptor = pd;
                    nfc.DeclaringMember    = fullyQualifiedMemberName;
                }
                if (pd != null)
                {
                    if (nfc.FieldType == null)
                    {
                        nfc.FieldType = pd.PropertyType;
                    }
                }

                if (subRecordType == null)
                {
                    JSONRecordFieldConfigurations.Add(nfc);
                }
                else
                {
                    AddFieldForType(subRecordType, nfc);
                }
            }
        }