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!



        

2 comments

Discussion is closed. Login to edit/delete existing comments.

  • Bas van Harten 0

    Seems like an excellent candidate for extending it with a source generator implementation

  • nasreddine ferchichi 0

    Hi Sam
    I want to know if there is any documentation how to override the IEDM model builder to allow access to the entities properties depending on the user coming from basic authentication. when he make the call to the controller

Feedback usabilla icon