Skip to content

$metadata missing on dynamically registered models #1318

Answered by habbes
Remo asked this question in Q&A
Discussion options

You must be logged in to vote

@Remo thanks for the clarification. I had misunderstood the message. The /$metadata endpoint returns the schema of the service as defined in your IEdmModel. This endpoint is usually handled by a built-in controller that's registered when you call AddOData().

However, in the project that you have linked it seems it uses custom dynamic rooting, and not the built-in one. I have not gone through the entire codebase to see what could be missing, but an easy workaround would be to add a custom route in your controller to handle the $metadata endpoint and return the model:

public class AnyNameForController : Controller
{
    [HttpGet]
    [ODataRoute("$metadata")]
    public IEdmModel GetMetadata()

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Remo
Comment options

@habbes
Comment options

Answer selected by xuzhg
@Remo
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants