File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
src/JsonApiDotNetCore/Internal Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ namespace JsonApiDotNetCore.Internal
77 public interface IContextGraph
88 {
99 /// <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,
1111 /// on the provided instance.
1212 /// </summary>
1313 /// <param name="resource">The resource instance</param>
@@ -42,6 +42,12 @@ public interface IContextGraph
4242 /// </summary>
4343 ContextEntity GetContextEntity ( Type entityType ) ;
4444
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+
4551 /// <summary>
4652 /// Was built against an EntityFrameworkCore DbContext ?
4753 /// </summary>
@@ -111,5 +117,13 @@ public string GetRelationshipName<TParent>(string relationshipName)
111117 . SingleOrDefault ( r => r . Is ( relationshipName ) )
112118 ? . InternalRelationshipName ;
113119 }
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+ }
115129}
You can’t perform that action at this time.
0 commit comments