protected override void Initialize(HttpConfiguration configuration) { var builder = new ODataConventionModelBuilder(); builder.Namespace = "Test"; builder.EnableLowerCamelCase(); configuration.EnableCaseInsensitive(true); configuration.EnableMediaResources(); var people = builder.EntitySet <Person>("People"); var person = people.EntityType; person.Namespace = builder.Namespace; person.HasKey(p => p.Id); person.MediaType(p => p.PhotoImageType); person.Ignore(p => p.Flags); person.Ignore(p => p.Timestamp); person.Ignore(p => p.SeoTerms); person.Ignore(p => p.Links); person.Ignore(p => p.PhotoImage); person.Ignore(p => p.Birthday); person.Ignore(p => p.DisplayStyle); var model = builder.GetEdmModelWithAnnotations(); configuration.MapODataServiceRoute("odata", "api", model); }
protected override void Initialize(HttpConfiguration configuration) { var builder = new ODataConventionModelBuilder(); builder.Namespace = "Unit.Test"; builder.EnableLowerCamelCase(); var address = builder.ComplexType <Address>(); var people = builder.EntitySet <Person>("People"); var person = people.EntityType; address.Namespace = builder.Namespace; address.HasAnnotation(a => a.IsPrimary); people.HasAnnotation("Version", 2.0); people.HasComplexAnnotations("Links", new[] { new Link("help", new Uri("http://localhost/api/help")) }); person.Namespace = builder.Namespace; person.HasKey(p => p.Id); person.HasAnnotation(p => p.Timestamp); person.HasAnnotation(p => p.Flags); person.HasAnnotations(p => p.SeoTerms); person.HasComplexAnnotations(p => p.Links); person.Ignore(p => p.PhotoImage); person.Ignore(p => p.PhotoImageType); person.HasAnnotation(p => p.Birthday).ForProperty(p => p.Age); person.HasComplexAnnotation(p => p.DisplayStyle).ForProperty(p => p.FirstName); var model = builder.GetEdmModelWithAnnotations(); configuration.EnableCaseInsensitive(true); configuration.EnableInstanceAnnotations(); configuration.MapODataServiceRoute("odata", "api", model); }
public static void Register(HttpConfiguration configuration) { var builder = new ODataConventionModelBuilder(); builder.Namespace = "Examples"; builder.EnableLowerCamelCase(); BuildDeviceModel(builder); BuildReceiptModel(builder); var model = builder.GetEdmModelWithAnnotations(); configuration.EnableCaseInsensitive(true); configuration.EnableInstanceAnnotations(); configuration.EnableMediaResources(); configuration.MapODataServiceRoute("odata", "api", model); }