-
-
Notifications
You must be signed in to change notification settings - Fork 261
/
Copy pathParseRelationExtensions.cs
29 lines (26 loc) · 1.09 KB
/
ParseRelationExtensions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
namespace Parse.Abstractions.Internal;
/// <summary>
/// So here's the deal. We have a lot of internal APIs for ParseObject, ParseUser, etc.
///
/// These cannot be 'internal' anymore if we are fully modularizing things out, because
/// they are no longer a part of the same library, especially as we create things like
/// Installation inside push library.
///
/// So this class contains a bunch of extension methods that can live inside another
/// namespace, which 'wrap' the intenral APIs that already exist.
/// </summary>
public static class ParseRelationExtensions
{
public static ParseRelation<T> Create<T>(ParseObject parent, string childKey) where T : ParseObject
{
return new ParseRelation<T>(parent, childKey);
}
public static ParseRelation<T> Create<T>(ParseObject parent, string childKey, string targetClassName) where T : ParseObject
{
return new ParseRelation<T>(parent, childKey, targetClassName);
}
public static string GetTargetClassName<T>(this ParseRelation<T> relation) where T : ParseObject
{
return relation.TargetClassName;
}
}