/// <summary> /// 设置保留小数位数 /// </summary> /// <param name="propertyInfo">属性信息</param> /// <param name="setting">属性设置</param> private static void SetScale(PropertyInfo propertyInfo, PropertySetting setting) { if (!Types.IsNumericType(Reflections.GetUnderlyingType(propertyInfo.PropertyType))) { return; } var attribute = propertyInfo.GetCustomAttribute <DecimalScaleAttribute>(); if (attribute != null) { setting.DecimalScale = attribute.Scale; } }