Custom Stream Entity

Applies To:# OData WebApi v7 for aspnet webapi supported Green circle with a checkmark inside it. OData AspNet WebApi V7# OData Webapi for Webapi supported Green circular checkmark icon to indicate a success. OData AspNet WebApi V6

Since Web API OData V5.7, it supports to customize entity as stream.

Fluent API

Users can call fluent API to configure the stream entity. For example,

var builder = new ODataModelBuilder();
builder.EntityType<Vehicle>().MediaType();
...
IEdmModel model = builder.GetEdmModel();

Convention model builder

Users can put [MediaType] attribute on a CLR class to configure the stream entity. For example,

[MediaType]  
public class Vehicle
{
  [Key]
  public int Id {get;set;}
  ...
}

var builder = new ODataConventionModelBuilder();
builder.EntityType<Vehicle>();
IEdmModel model = builder.GetEdmModel();