@@ -23,6 +23,10 @@ namespace NHibernate.SqlTypes
23
23
[ Serializable ]
24
24
public class SqlType : IEquatable < SqlType >
25
25
{
26
+ private readonly int ? _length ;
27
+ private readonly byte ? _precision ;
28
+ private readonly byte ? _scale ;
29
+
26
30
public SqlType ( DbType dbType )
27
31
{
28
32
DbType = dbType ;
@@ -31,40 +35,33 @@ public SqlType(DbType dbType)
31
35
public SqlType ( DbType dbType , int length )
32
36
{
33
37
DbType = dbType ;
34
- Length = length ;
35
- LengthDefined = true ;
38
+ _length = length ;
36
39
}
37
40
38
41
public SqlType ( DbType dbType , byte precision , byte scale )
39
42
{
40
43
DbType = dbType ;
41
- Precision = precision ;
42
- Scale = scale ;
43
- ScaleDefined = true ;
44
- PrecisionDefined = true ;
44
+ _precision = precision ;
45
+ _scale = scale ;
45
46
}
46
47
47
48
public SqlType ( DbType dbType , byte scale )
48
49
{
49
50
DbType = dbType ;
50
- Scale = scale ;
51
- ScaleDefined = true ;
51
+ _scale = scale ;
52
52
}
53
53
54
54
public DbType DbType { get ; }
55
55
56
- public int Length { get ; }
57
-
58
- public byte Precision { get ; }
59
-
60
- public byte Scale { get ; }
56
+ public int Length => _length . GetValueOrDefault ( ) ;
57
+ public byte Precision => _precision . GetValueOrDefault ( ) ;
58
+ public byte Scale => _scale . GetValueOrDefault ( ) ;
59
+ public bool LengthDefined => _length . HasValue ;
61
60
62
- public bool LengthDefined { get ; }
61
+ public bool PrecisionDefined => _precision . HasValue ;
63
62
64
- public bool PrecisionDefined { get ; }
65
-
66
63
67
- public bool ScaleDefined { get ; }
64
+ public bool ScaleDefined => _scale . HasValue ;
68
65
69
66
#region System.Object Members
70
67
0 commit comments