private static TypeConverter GetComplexTypeToScalarConverter(Type type, NumericFieldAttribute metadata)
        {
            if (metadata.Converter != null)
            {
                return((TypeConverter)Activator.CreateInstance(metadata.Converter));
            }

            type = type.GetUnderlyingType();

            if (type == typeof(DateTime))
            {
                return(new DateTimeToTicksConverter());
            }
            if (type == typeof(DateTimeOffset))
            {
                return(new DateTimeOffsetToTicksConverter());
            }

            return(null);
        }
        internal static ReflectionFieldMapper <T> BuildNumeric <T>(PropertyInfo p, Type type, NumericFieldAttribute metadata)
        {
            var fieldName = metadata.Field ?? p.Name;
            var typeToValueTypeConverter   = GetComplexTypeToScalarConverter(type, metadata);
            var valueTypeToStringConverter = (TypeConverter)null;

            if (typeToValueTypeConverter != null)
            {
                valueTypeToStringConverter = GetScalarToStringConverter(typeToValueTypeConverter);
            }
            else
            {
                valueTypeToStringConverter = FieldMappingInfoBuilder.GetConverter(p, type, null);
            }

            return(new NumericReflectionFieldMapper <T>(p, metadata.Store, typeToValueTypeConverter, valueTypeToStringConverter, fieldName,
                                                        metadata.PrecisionStep, metadata.Boost));
        }