You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.4 KiB

4 years ago
using System;
namespace ChangKeTec.Wms.Models
{
/// <summary>
/// <para>自定义Decimal类型的精度属性</para>
/// </summary>
[AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)]
public sealed class DecimalPrecisionAttribute : Attribute
{
#region Field
private byte _precision = 18;
public byte _scale = 4;
#endregion
#region Construct
/// <summary>
/// <para>自定义Decimal类型的精确度属性</para>
/// </summary>
/// <param name="precision">precision
/// <para>精度(默认18)</para></param>
/// <param name="scale">scale
/// <para>小数位数(默认4)</para></param>
public DecimalPrecisionAttribute(byte precision = 18, byte scale = 4)
{
Precision = precision;
Scale = scale;
}
#endregion
#region Property
/// <summary>
/// 精确度(默认18)
/// </summary>
public byte Precision
{
get { return this._precision; }
set { this._precision = value; }
}
/// <summary>
/// 保留位数(默认4)
/// </summary>
public byte Scale
{
get { return this._scale; }
set { this._scale = value; }
}
#endregion
}
}