private void DiscoverRecordFields(Type recordType)
        {
            if (!IsDynamicObject)
            {
                KVPRecordFieldConfigurations.Clear();

                if (ChoTypeDescriptor.GetProperties(recordType).Where(pd => pd.Attributes.OfType <ChoKVPRecordFieldAttribute>().Any()).Any())
                {
                    foreach (PropertyDescriptor pd in ChoTypeDescriptor.GetProperties(recordType).Where(pd => pd.Attributes.OfType <ChoKVPRecordFieldAttribute>().Any()))
                    {
                        //if (!pd.PropertyType.IsSimple())
                        //    throw new ChoRecordConfigurationException("Property '{0}' is not a simple type.".FormatString(pd.Name));

                        var obj = new ChoKVPRecordFieldConfiguration(pd.Name, pd.Attributes.OfType <ChoKVPRecordFieldAttribute>().First());
                        obj.FieldType = pd.PropertyType;
                        KVPRecordFieldConfigurations.Add(obj);
                    }
                }
                else
                {
                    foreach (PropertyDescriptor pd in ChoTypeDescriptor.GetProperties(recordType))
                    {
                        //if (!pd.PropertyType.IsSimple())
                        //    throw new ChoRecordConfigurationException("Property '{0}' is not a simple type.".FormatString(pd.Name));

                        var obj = new ChoKVPRecordFieldConfiguration(pd.Name);
                        obj.FieldType = pd.PropertyType;
                        KVPRecordFieldConfigurations.Add(obj);
                    }
                }
            }
        }
 private void DiscoverRecordFields(Type recordType, bool clear = true)
 {
     if (clear)
     {
         KVPRecordFieldConfigurations.Clear();
     }
     DiscoverRecordFields(recordType, null,
                          ChoTypeDescriptor.GetProperties(recordType).Where(pd => pd.Attributes.OfType <ChoKVPRecordFieldAttribute>().Any()).Any());
 }
 public ChoKVPRecordConfiguration ClearFields()
 {
     //KVPRecordFieldConfigurationsForType.Clear();
     KVPRecordFieldConfigurations.Clear();
     return(this);
 }