Skip to content

Commit 7204a0a

Browse files
committed
Add TypeInfoCollection [Obsolete] methods for compatibility
1 parent 6f77d06 commit 7204a0a

1 file changed

Lines changed: 84 additions & 0 deletions

File tree

Orm/Xtensive.Orm/Orm/Model/TypeInfoCollection.cs

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,90 @@ public TypeInfo Find(string fullName)
167167
return fullNameTable.TryGetValue(fullName, out result) ? result : null;
168168
}
169169

170+
171+
/// <summary>
172+
/// Finds the ancestor of the specified <paramref name="item"/>.
173+
/// </summary>
174+
/// <param name="item">The type to search ancestor for.</param>
175+
/// <returns><see cref="TypeInfo"/> instance that is ancestor of specified <paramref name="item"/> or
176+
/// <see langword="null"/> if the ancestor is not found in this collection.</returns>
177+
/// <exception cref="ArgumentNullException">When <paramref name="item"/> is <see langword="null"/>.</exception>
178+
[Obsolete("Use TypeInfo.Ancestor")]
179+
public TypeInfo FindAncestor(TypeInfo item) => item.Ancestor;
180+
181+
/// <summary>
182+
/// Finds the set of direct descendants of the specified <paramref name="item"/>.
183+
/// </summary>
184+
/// <param name="item">The type to search descendants for.</param>
185+
/// <returns><see cref="IEnumerable{T}"/> of <see cref="TypeInfo"/> instance that are descendants of specified <paramref name="item"/>.</returns>
186+
/// <exception cref="ArgumentNullException">When <paramref name="item"/> is <see langword="null"/>.</exception>
187+
[Obsolete("Use TypeInfo.Descendants")]
188+
public IEnumerable<TypeInfo> FindDescendants(TypeInfo item) => item.Descendants;
189+
190+
/// <summary>
191+
/// Finds the set of descendants of the specified <paramref name="item"/>.
192+
/// </summary>
193+
/// <param name="item">The type to search descendants for.</param>
194+
/// <param name="recursive">if set to <see langword="true"/> then both direct and nested descendants will be returned.</param>
195+
/// <returns>
196+
/// <see cref="IEnumerable{T}"/> of <see cref="TypeInfo"/> instance that are descendants of specified <paramref name="item"/>.
197+
/// </returns>
198+
/// <exception cref="ArgumentNullException">When <paramref name="item"/> is <see langword="null"/>.</exception>
199+
[Obsolete("Use TypeInfo.Descendants/.RecursiveDescendants")]
200+
public IEnumerable<TypeInfo> FindDescendants(TypeInfo item, bool recursive) =>
201+
recursive ? item.RecursiveDescendants : item.Descendants;
202+
203+
/// <summary>
204+
/// Find the <see cref="IList{T}"/> of interfaces that specified <paramref name="item"/> implements.
205+
/// </summary>
206+
/// <param name="item">The type to search interfaces for.</param>
207+
/// <returns><see cref="IEnumerable{T}"/> of <see cref="TypeInfo"/> instance that are implemented by specified <paramref name="item"/>.</returns>
208+
/// <exception cref="ArgumentNullException">When <paramref name="item"/> is <see langword="null"/>.</exception>
209+
[Obsolete("Use TypeInfo.Interfaces")]
210+
public IEnumerable<TypeInfo> FindInterfaces(TypeInfo item) => item.Interfaces;
211+
212+
/// <summary>
213+
/// Find the <see cref="IList{T}"/> of interfaces that specified <paramref name="item"/> implements.
214+
/// </summary>
215+
/// <param name="item">The type to search interfaces for.</param>
216+
/// <param name="recursive">if set to <see langword="true"/> then both direct and non-direct implemented interfaces will be returned.</param>
217+
/// <returns><see cref="IEnumerable{T}"/> of <see cref="TypeInfo"/> instance that are implemented by specified <paramref name="item"/>.</returns>
218+
/// <exception cref="ArgumentNullException">When <paramref name="item"/> is <see langword="null"/>.</exception>
219+
[Obsolete("Use TypeInfo.Interfaces/.RecursiveInterfaces")]
220+
public IEnumerable<TypeInfo> FindInterfaces(TypeInfo item, bool recursive) =>
221+
recursive ? item.RecursiveInterfaces : item.Interfaces;
222+
223+
/// <summary>
224+
/// Finds the set of direct implementors of the specified <paramref name="item"/>.
225+
/// </summary>
226+
/// <param name="item">The type to search implementors for.</param>
227+
/// <returns><see cref="IEnumerable{T}"/> of <see cref="TypeInfo"/> instance that are implementors of specified <paramref name="item"/>.</returns>
228+
/// <exception cref="ArgumentNullException">When <paramref name="item"/> is <see langword="null"/>.</exception>
229+
[Obsolete("Use TypeInfo.Implementors")]
230+
public IEnumerable<TypeInfo> FindImplementors(TypeInfo item) => item.Implementors;
231+
232+
/// <summary>
233+
/// Finds the set of implementors of the specified <paramref name="item"/>.
234+
/// </summary>
235+
/// <param name="item">The type to search implementors for.</param>
236+
/// <param name="recursive">if set to <see langword="true"/> then both direct and nested implementors will be returned.</param>
237+
/// <returns>
238+
/// <see cref="IEnumerable{T}"/> of <see cref="TypeInfo"/> instance that are implementors of specified <paramref name="item"/>.
239+
/// </returns>
240+
/// <exception cref="ArgumentNullException">When <paramref name="item"/> is <see langword="null"/>.</exception>
241+
[Obsolete("Use TypeInfo.Implementors/.RecursiveImplementors")]
242+
public IEnumerable<TypeInfo> FindImplementors(TypeInfo item, bool recursive) =>
243+
recursive ? item.RecursiveImplementors : item.Implementors;
244+
245+
/// <summary>
246+
/// Finds the root of the specified <paramref name="item"/>.
247+
/// </summary>
248+
/// <param name="item">The type to search root for.</param>
249+
/// <returns><see cref="TypeInfo"/> instance that is root of specified <paramref name="item"/>.</returns>
250+
/// <exception cref="ArgumentNullException">When <paramref name="item"/> is <see langword="null"/>.</exception>
251+
[Obsolete("Use TypeInfo.GetRoot()")]
252+
public TypeInfo FindRoot(TypeInfo item) => item.GetRoot();
253+
170254
/// <summary>
171255
/// Finds the ancestor of the specified <paramref name="type"/>.
172256
/// </summary>

0 commit comments

Comments
 (0)