Skip to content

Commit 36ef6b0

Browse files
committed
Added overloads for ParseObject.RegisterSubclass and ParseObject.UnregisterSubclass methods, which take a reference to Type and un-/ register it as parse subclass
1 parent 9823a6f commit 36ef6b0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Parse/Public/ParseObject.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,18 @@ internal virtual void SetDefaultValues() { }
218218
/// <typeparam name="T">The ParseObject subclass type to register.</typeparam>
219219
public static void RegisterSubclass<T>() where T : ParseObject, new() => SubclassingController.RegisterSubclass(typeof(T));
220220

221+
/// <summary>
222+
/// Registers a custom subclass type with the Parse SDK, enabling strong-typing of those ParseObjects whenever
223+
/// they appear. Subclasses must specify the ParseClassName attribute, have a default constructor, and properties
224+
/// backed by ParseObject fields should have ParseFieldName attributes supplied.
225+
/// </summary>
226+
/// <param name="type">The ParseObject subclass type to register.</param>
227+
public static void RegisterSubclass(Type type) { if (typeof(ParseObject).IsAssignableFrom(type)) SubclassingController.RegisterSubclass(type); }
228+
221229
internal static void UnregisterSubclass<T>() where T : ParseObject, new() => SubclassingController.UnregisterSubclass(typeof(T));
230+
internal static void UnregisterSubclass(Type type) { if (typeof(ParseObject).IsAssignableFrom(type)) SubclassingController.UnregisterSubclass(type); }
231+
232+
222233

223234
/// <summary>
224235
/// Clears any changes to this object made since the last call to <see cref="SaveAsync()"/>.

0 commit comments

Comments
 (0)