Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Created Issue: Can't serialize edm model which is different with the one in the formatter [576]

$
0
0
If user wants to write his own metadata controller to return metadata which is different with the model in the formatter, it will still return the model from formatter.

For example, I build an empty edm model from CustomMetadataController.
public class CustomMetadataController : ApiController
{
public IEdmModel GetMetadata()
{
ODataConventionModelBuilder mb = new ODataConventionModelBuilder();
return mb.GetEdmModel();
//return Program.GetEdmModel();
}
}

In my formatter, I use another model:
public static IEdmModel GetEdmModel()
{
ODataConventionModelBuilder mb = new ODataConventionModelBuilder();
mb.EntitySet<Todo>("Todo").EntityType.Property(t => t.Name).IsRequired();
return mb.GetEdmModel();
}

And configure route as:
configuration.Routes.MapHttpRoute(ODataRouteNames.Metadata, "$metadata", new { Controller = "CustomMetadata", Action = "GetMetadata" });

The returned metadata is still has Todo entity set. This is quite weird.

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>