@@ -23,71 +23,45 @@ namespace NHibernate.SqlTypes
23
23
[ Serializable ]
24
24
public class SqlType : IEquatable < SqlType >
25
25
{
26
- private readonly DbType dbType ;
27
- private readonly int length ;
28
- private readonly byte precision ;
29
- private readonly byte scale ;
30
- private readonly bool lengthDefined ;
31
- private readonly bool precisionDefined ;
26
+ private readonly int ? _length ;
27
+ private readonly byte ? _precision ;
28
+ private readonly byte ? _scale ;
32
29
33
30
public SqlType ( DbType dbType )
34
31
{
35
- this . dbType = dbType ;
32
+ DbType = dbType ;
36
33
}
37
34
38
35
public SqlType ( DbType dbType , int length )
39
36
{
40
- this . dbType = dbType ;
41
- this . length = length ;
42
- lengthDefined = true ;
37
+ DbType = dbType ;
38
+ _length = length ;
43
39
}
44
40
45
41
public SqlType ( DbType dbType , byte precision , byte scale )
46
42
{
47
- this . dbType = dbType ;
48
- this . precision = precision ;
49
- this . scale = scale ;
50
- precisionDefined = true ;
43
+ DbType = dbType ;
44
+ _precision = precision ;
45
+ _scale = scale ;
51
46
}
52
47
53
48
public SqlType ( DbType dbType , byte scale )
54
49
{
55
- this . dbType = dbType ;
56
- this . scale = scale ;
57
- ScaleDefined = true ;
50
+ DbType = dbType ;
51
+ _scale = scale ;
58
52
}
59
53
60
- public DbType DbType
61
- {
62
- get { return dbType ; }
63
- }
64
-
65
- public int Length
66
- {
67
- get { return length ; }
68
- }
69
-
70
- public byte Precision
71
- {
72
- get { return precision ; }
73
- }
54
+ public DbType DbType { get ; }
74
55
75
- public byte Scale
76
- {
77
- get { return scale ; }
78
- }
56
+ public int Length => _length . GetValueOrDefault ( ) ;
57
+ public byte Precision => _precision . GetValueOrDefault ( ) ;
58
+ public byte Scale => _scale . GetValueOrDefault ( ) ;
59
+ public bool LengthDefined => _length . HasValue ;
79
60
80
- public bool LengthDefined
81
- {
82
- get { return lengthDefined ; }
83
- }
61
+ public bool PrecisionDefined => _precision . HasValue ;
84
62
85
- public bool PrecisionDefined
86
- {
87
- get { return precisionDefined ; }
88
- }
89
63
90
- public bool ScaleDefined { get ; }
64
+ public bool ScaleDefined => _scale . HasValue ;
91
65
92
66
#region System.Object Members
93
67
0 commit comments