File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
src/Common.OData.ApiExplorer/AspNet.OData/Routing Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -135,6 +135,7 @@ void AppendEntitySetOrOperation( IList<string> segments )
135135 case EntitySet :
136136 builder . Append ( controllerName ) ;
137137 AppendEntityKeysFromConvention ( builder ) ;
138+ AppendNavigationPropertyFromConvention ( builder ) ;
138139 break ;
139140 case BoundOperation :
140141 builder . Append ( controllerName ) ;
@@ -202,6 +203,23 @@ void AppendEntityKeysFromConvention( StringBuilder builder )
202203 }
203204 }
204205
206+ void AppendNavigationPropertyFromConvention ( StringBuilder builder )
207+ {
208+ Contract . Requires ( builder != null ) ;
209+
210+ var actionName = Context . ActionDescriptor . ActionName ;
211+ var properties = Context . EntitySet . EntityType ( ) . NavigationProperties ( ) ;
212+ var property = properties . FirstOrDefault ( p => actionName . EndsWith ( p . Name , OrdinalIgnoreCase ) ) ;
213+
214+ if ( property == null )
215+ {
216+ return ;
217+ }
218+
219+ builder . Append ( '/' ) ;
220+ builder . Append ( property . Name ) ;
221+ }
222+
205223 void AppendParametersFromConvention ( StringBuilder builder , IEdmOperation operation )
206224 {
207225 Contract . Requires ( builder != null ) ;
You can’t perform that action at this time.
0 commit comments