Skip to content

Commit 3836b45

Browse files
committed
Add endpoint to get the metadata
1 parent 54864f2 commit 3836b45

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

v8.x/DynamicRouteSample/DynamicRouteSample/Controllers/Controllers.cs

+10
Original file line numberDiff line numberDiff line change
@@ -117,5 +117,15 @@ public IActionResult Get(string entitySet, int key, string property)
117117
object propertyValue = propertyInfo.GetValue(data);
118118
return Ok(propertyValue);
119119
}
120+
121+
[HttpGet]
122+
[ODataRoute("$metadata")]
123+
public IActionResult GetMetadata([FromServices]IODataModelProvider modelProvider)
124+
{
125+
IODataFeature feature = Request.ODataFeature();
126+
string prefix = feature.RoutingConventionsStore["odata_prefix"] as string;
127+
128+
return Ok(modelProvider.GetEdmModel(prefix));
129+
}
120130
}
121131
}

0 commit comments

Comments
 (0)