Quantcast
Channel: Web API
Viewing all articles
Browse latest Browse all 4850

How to manually build odata metadata?

$
0
0

Hi,

I'm working with odata. Here I get a requirement where I need to have a WebApi method which generate the metadata xml by the given entity name, like this:

string GetSingleEntityMetadata(string entityName);

the return result should exactly like the request from /$metadata does, but just contains the specified entity. 

Is there a way to achieve that?

BTW, Is there a way to create these XML edm model from IEdmModel? In my code, the IEdmModel is already available.

var builder = new ODataConventionModelBuilder();
builder.EntitySet<Contact>("Contacts");
builder.Namespace = typeof(Contact).Namespace;
var model = builder.GetEdmModel();

 


Viewing all articles
Browse latest Browse all 4850

Latest Images

Trending Articles



Latest Images