April 30th, 2020

OData Model Builder now Available

Sam Xu
Senior Software Engineer

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!


        

Author

Sam Xu
Senior Software Engineer

Sam is a Senior software engineer at Microsoft with over than 10 years of software developement experience. He's worked on a wide variety of platforms such as (C++, C#, etc.) and currently works on the OData team to design and implement features in the .NET stack of Microsoft's OData libraries. OData (Open Data Protocol) is an ISO/IEC approved, OASIS standard that defines a set of best practices for building and consuming RESTful APIs. You can find more information about OData at ...

More about author

2 comments

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

  • nasreddine ferchichi

    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

  • Bas van Harten

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