1
1
using System ;
2
+ using System . Collections . Generic ;
2
3
using System . Data ;
3
4
using static System . FormattableString ;
4
5
@@ -12,6 +13,7 @@ public class SqlColumn
12
13
private SqlDbType _dataType = SqlDbType . VarChar ; // backwards-compatibility default
13
14
private string _columnName = string . Empty ;
14
15
private string _propertyName ;
16
+ private List < string > _propertyNameHierarchy = new List < string > ( ) ;
15
17
16
18
/// <summary>
17
19
/// Default constructor.
@@ -104,13 +106,30 @@ public SqlDbType DataType
104
106
public string PropertyName
105
107
{
106
108
get => _propertyName ?? ColumnName ;
107
- set => _propertyName = value ;
109
+ set
110
+ {
111
+ _propertyName = value ;
112
+ ParseHierarchicalPropertyName ( value ) ;
113
+ }
108
114
}
109
115
116
+ /// <summary>
117
+ /// List of the hierachical parts of a property name and all sub properties (e.g. Property.Settings.EventName)
118
+ /// </summary>
119
+ internal IReadOnlyList < string > PropertyNameHierarchy
120
+ => _propertyNameHierarchy ;
121
+
122
+ /// <summary>
123
+ /// True if property name is hierarchical (e.g. Property.Settings.EventName)
124
+ /// </summary>
125
+ internal bool HasHierarchicalPropertyName
126
+ => _propertyNameHierarchy . Count > 1 ;
127
+
110
128
// Set by the constructors of the Standard Column classes that inherit from this;
111
129
// allows Standard Columns and user-defined columns to coexist but remain identifiable
112
130
// and allows casting back to the Standard Column without a lot of switch gymnastics.
113
131
internal StandardColumn ? StandardColumnIdentifier { get ; set ; }
132
+
114
133
internal Type StandardColumnType { get ; set ; }
115
134
116
135
/// <summary>
@@ -150,5 +169,10 @@ internal void SetDataTypeFromConfigString(string requestedSqlType)
150
169
151
170
DataType = sqlType ;
152
171
}
172
+
173
+ private void ParseHierarchicalPropertyName ( string propertyName )
174
+ {
175
+ _propertyNameHierarchy . AddRange ( propertyName . Split ( '.' ) ) ;
176
+ }
153
177
}
154
178
}
0 commit comments