OData Model Builder now Available

Sam Xu

How to empower developers to build OData Edm model easily from their data model (C# classes) is one of the most important task in OData team. Today, we are pleased to announce the first beta version of OData model builder available at https://www.nuget.org/packages/Microsoft.OData.ModelBuilder.

Please try this package by installing as:

Install-Package Microsoft.OData.ModelBuilder

The basic usage of the Edm model is to use the conventional model builder, here’s sample codes

ODataConventionModelBuilder modelBuilder = new ODataConventionModelBuilder();
modelBuilder.EntitySet<Customer>("Customers");
modelBuilder.EntitySet<Order>("Orders");
IEdmModel model = modelBuilder.GetEdmModel();

// Your date model (C# class)
public class Customer
{
  //
}
public class Order
{
  //
}

 

For all other detail usage of the model builder, please refer to: https://docs.microsoft.com/en-us/odata/webapi/model-builder-abstract

To release model builder as a simple package can also help developers to build their OData tooling ecosystem easily. Meanwhile, for OData team, it can fasten the model builder release cycle.  So, we are planning to introduce more features (for example, term configuration, vocabulary annotation, etc) in the next release. Please feel free to share your feature requirements, report issues at https://github.com/OData/modelbuilder.

Thanks!