File tree 1 file changed +16
-2
lines changed
src/JsonApiDotNetCore/Internal
1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ namespace JsonApiDotNetCore.Internal
7
7
public interface IContextGraph
8
8
{
9
9
/// <summary>
10
- /// Gets the value of the navigation property, defined by the relationshipName,
10
+ /// Gets the value of the navigation property, defined by the relationshipName,
11
11
/// on the provided instance.
12
12
/// </summary>
13
13
/// <param name="resource">The resource instance</param>
@@ -42,6 +42,12 @@ public interface IContextGraph
42
42
/// </summary>
43
43
ContextEntity GetContextEntity ( Type entityType ) ;
44
44
45
+ /// <summary>
46
+ /// Get the public attribute name for a type based on the internal attribute name.
47
+ /// </summary>
48
+ /// <param name="internalAttributeName">The internal attribute name for a <see cref="Attr" />.</param>
49
+ string GetPublicAttributeName < TParent > ( string internalAttributeName ) ;
50
+
45
51
/// <summary>
46
52
/// Was built against an EntityFrameworkCore DbContext ?
47
53
/// </summary>
@@ -111,5 +117,13 @@ public string GetRelationshipName<TParent>(string relationshipName)
111
117
. SingleOrDefault ( r => r . Is ( relationshipName ) )
112
118
? . InternalRelationshipName ;
113
119
}
114
- }
120
+
121
+ public string GetPublicAttributeName < TParent > ( string internalAttributeName )
122
+ {
123
+ return GetContextEntity ( typeof ( TParent ) )
124
+ . Attributes
125
+ . Single ( a => a . InternalAttributeName == internalAttributeName )
126
+ . PublicAttributeName ;
127
+ }
128
+ }
115
129
}
You can’t perform that action at this time.
0 commit comments