11using System ;
2+ using System . ComponentModel ;
23using System . Data ;
34using System . Runtime . CompilerServices ;
45
@@ -92,6 +93,7 @@ public class Identity : IEquatable<Identity>
9293
9394 internal virtual Type GetType ( int index ) => throw new IndexOutOfRangeException ( nameof ( index ) ) ;
9495
96+ #pragma warning disable CS0618 // Type or member is obsolete
9597 internal Identity ForGrid < TFirst , TSecond , TThird , TFourth , TFifth , TSixth , TSeventh > ( Type primaryType , int gridIndex ) =>
9698 new Identity < TFirst , TSecond , TThird , TFourth , TFifth , TSixth , TSeventh > ( sql , commandType , connectionString , primaryType , parametersType , gridIndex ) ;
9799
@@ -110,12 +112,14 @@ internal Identity ForGrid(Type primaryType, Type[] otherTypes, int gridIndex) =>
110112 /// <returns></returns>
111113 public Identity ForDynamicParameters ( Type type ) =>
112114 new Identity ( sql , commandType , connectionString , this . type , type , 0 , - 1 ) ;
115+ #pragma warning restore CS0618 // Type or member is obsolete
113116
114117 internal Identity ( string sql , CommandType ? commandType , IDbConnection connection , Type ? type , Type ? parametersType )
115118 : this ( sql , commandType , connection . ConnectionString , type , parametersType , 0 , 0 ) { /* base call */ }
116119
117120 private protected Identity ( string sql , CommandType ? commandType , string connectionString , Type ? type , Type ? parametersType , int otherTypesHash , int gridIndex )
118121 {
122+ #pragma warning disable CS0618 // Type or member is obsolete
119123 this . sql = sql ;
120124 this . commandType = commandType ;
121125 this . connectionString = connectionString ;
@@ -133,6 +137,7 @@ private protected Identity(string sql, CommandType? commandType, string connecti
133137 hashCode = ( hashCode * 23 ) + ( connectionString is null ? 0 : connectionStringComparer . GetHashCode ( connectionString ) ) ;
134138 hashCode = ( hashCode * 23 ) + ( parametersType ? . GetHashCode ( ) ?? 0 ) ;
135139 }
140+ #pragma warning restore CS0618 // Type or member is obsolete
136141 }
137142
138143 /// <summary>
@@ -144,48 +149,101 @@ private protected Identity(string sql, CommandType? commandType, string connecti
144149 /// <summary>
145150 /// The raw SQL command.
146151 /// </summary>
152+ [ Browsable ( false ) , EditorBrowsable ( EditorBrowsableState . Never ) ]
153+ [ Obsolete ( "Please use " + nameof ( Sql ) + ". This API may be removed at a later date." ) ]
147154 public readonly string sql ;
148155
156+ /// <summary>
157+ /// The raw SQL command.
158+ /// </summary>
159+ #pragma warning disable CS0618 // Type or member is obsolete
160+ public string Sql => sql ;
161+ #pragma warning restore CS0618 // Type or member is obsolete
162+
149163 /// <summary>
150164 /// The SQL command type.
151165 /// </summary>
166+ [ Browsable ( false ) , EditorBrowsable ( EditorBrowsableState . Never ) ]
167+ [ Obsolete ( "Please use " + nameof ( CommandType ) + ". This API may be removed at a later date." ) ]
152168 public readonly CommandType ? commandType ;
153169
170+ /// <summary>
171+ /// The SQL command type.
172+ /// </summary>
173+ #pragma warning disable CS0618 // Type or member is obsolete
174+ public CommandType ? CommandType => commandType ;
175+ #pragma warning restore CS0618 // Type or member is obsolete
176+
154177 /// <summary>
155178 /// The hash code of this Identity.
156179 /// </summary>
180+ [ Browsable ( false ) , EditorBrowsable ( EditorBrowsableState . Never ) ]
181+ [ Obsolete ( "Please use " + nameof ( GetHashCode ) + ". This API may be removed at a later date." ) ]
157182 public readonly int hashCode ;
158183
159184 /// <summary>
160185 /// The grid index (position in the reader) of this Identity.
161186 /// </summary>
187+ [ Browsable ( false ) , EditorBrowsable ( EditorBrowsableState . Never ) ]
188+ [ Obsolete ( "Please use " + nameof ( GridIndex ) + ". This API may be removed at a later date." ) ]
162189 public readonly int gridIndex ;
163190
164191 /// <summary>
165- /// This <see cref="Type"/> of this Identity.
192+ /// The grid index (position in the reader) of this Identity.
166193 /// </summary>
194+ #pragma warning disable CS0618 // Type or member is obsolete
195+ public int GridIndex => gridIndex ;
196+ #pragma warning restore CS0618 // Type or member is obsolete
197+
198+ /// <summary>
199+ /// The <see cref="Type"/> of this Identity.
200+ /// </summary>
201+ [ Browsable ( false ) , EditorBrowsable ( EditorBrowsableState . Never ) ]
202+ [ Obsolete ( "Please use " + nameof ( Type ) + ". This API may be removed at a later date." ) ]
167203 public readonly Type ? type ;
168204
205+ /// <summary>
206+ /// The <see cref="Type"/> of this Identity.
207+ /// </summary>
208+ #pragma warning disable CS0618 // Type or member is obsolete
209+ public Type ? Type => type ;
210+ #pragma warning restore CS0618 // Type or member is obsolete
211+
169212 /// <summary>
170213 /// The connection string for this Identity.
171214 /// </summary>
215+ [ Browsable ( false ) , EditorBrowsable ( EditorBrowsableState . Never ) ]
216+ [ Obsolete ( "This API may be removed at a later date." ) ]
172217 public readonly string connectionString ;
173218
174219 /// <summary>
175220 /// The type of the parameters object for this Identity.
176221 /// </summary>
222+ [ Browsable ( false ) , EditorBrowsable ( EditorBrowsableState . Never ) ]
223+ [ Obsolete ( "Please use " + nameof ( ParametersType ) + ". This API may be removed at a later date." ) ]
177224 public readonly Type ? parametersType ;
178225
226+ /// <summary>
227+ /// The type of the parameters object for this Identity.
228+ /// </summary>
229+ #pragma warning disable CS0618 // Type or member is obsolete
230+ public Type ? ParametersType => parametersType ;
231+ #pragma warning restore CS0618 // Type or member is obsolete
232+
179233 /// <summary>
180234 /// Gets the hash code for this identity.
181235 /// </summary>
182236 /// <returns></returns>
237+ #pragma warning disable CS0618 // Type or member is obsolete
183238 public override int GetHashCode ( ) => hashCode ;
239+ #pragma warning restore CS0618 // Type or member is obsolete
184240
185241 /// <summary>
186242 /// See object.ToString()
187243 /// </summary>
244+ #pragma warning disable CS0618 // Type or member is obsolete
188245 public override string ToString ( ) => sql ;
246+ #pragma warning restore CS0618 // Type or member is obsolete
189247
190248 /// <summary>
191249 /// Compare 2 Identity objects
@@ -198,6 +256,7 @@ public bool Equals(Identity? other)
198256 if ( other is null ) return false ;
199257
200258 int typeCount ;
259+ #pragma warning disable CS0618 // Type or member is obsolete
201260 return gridIndex == other . gridIndex
202261 && type == other . type
203262 && sql == other . sql
@@ -206,6 +265,7 @@ public bool Equals(Identity? other)
206265 && parametersType == other . parametersType
207266 && ( typeCount = TypeCount ) == other . TypeCount
208267 && ( typeCount == 0 || TypesEqual ( this , other , typeCount ) ) ;
268+ #pragma warning restore CS0618 // Type or member is obsolete
209269 }
210270
211271 [ MethodImpl ( MethodImplOptions . NoInlining ) ]
0 commit comments