diff --git a/src/NHibernate/SqlTypes/SqlType.cs b/src/NHibernate/SqlTypes/SqlType.cs index 29523e9122e..0aca2e81921 100644 --- a/src/NHibernate/SqlTypes/SqlType.cs +++ b/src/NHibernate/SqlTypes/SqlType.cs @@ -23,71 +23,45 @@ namespace NHibernate.SqlTypes [Serializable] public class SqlType : IEquatable { - private readonly DbType dbType; - private readonly int length; - private readonly byte precision; - private readonly byte scale; - private readonly bool lengthDefined; - private readonly bool precisionDefined; + private readonly int? _length; + private readonly byte? _precision; + private readonly byte? _scale; public SqlType(DbType dbType) { - this.dbType = dbType; + DbType = dbType; } public SqlType(DbType dbType, int length) { - this.dbType = dbType; - this.length = length; - lengthDefined = true; + DbType = dbType; + _length = length; } public SqlType(DbType dbType, byte precision, byte scale) { - this.dbType = dbType; - this.precision = precision; - this.scale = scale; - precisionDefined = true; + DbType = dbType; + _precision = precision; + _scale = scale; } public SqlType(DbType dbType, byte scale) { - this.dbType = dbType; - this.scale = scale; - ScaleDefined = true; + DbType = dbType; + _scale = scale; } - public DbType DbType - { - get { return dbType; } - } - - public int Length - { - get { return length; } - } - - public byte Precision - { - get { return precision; } - } + public DbType DbType { get; } - public byte Scale - { - get { return scale; } - } + public int Length => _length.GetValueOrDefault(); + public byte Precision => _precision.GetValueOrDefault(); + public byte Scale => _scale.GetValueOrDefault(); + public bool LengthDefined => _length.HasValue; - public bool LengthDefined - { - get { return lengthDefined; } - } + public bool PrecisionDefined => _precision.HasValue; - public bool PrecisionDefined - { - get { return precisionDefined; } - } - public bool ScaleDefined { get; } + public bool ScaleDefined => _scale.HasValue; #region System.Object Members