using System.Web.OData.Builder; var modelBuilder = new ODataConventionModelBuilder(); modelBuilder.EntitySet("Customers"); return modelBuilder.GetEdmModel();
using System.Web.OData.Builder; var modelBuilder = new ODataConventionModelBuilder(); var addressType = modelBuilder.ComplexType(); addressType.Property(a => a.Street); addressType.Property(a => a.City); addressType.Property(a => a.State); addressType.Property(a => a.Zipcode); var customerType = modelBuilder.EntityTypeBoth examples use the System.Web.OData library to create an OData model using convention-based mapping. The ODataConventionModelBuilder class simplifies the process by automatically determining metadata based on naming conventions.(); customerType.ComplexProperty(c => c.HomeAddress); customerType.CollectionProperty(c => c.OtherAddresses); return modelBuilder.GetEdmModel();