public static void Register(HttpConfiguration config) { config.Select().Expand().Filter().OrderBy().MaxTop(100).Count(); config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always; config.MapODataServiceRoute("odata", "odata", SingletonEdmModel.GetEdmModel()); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseOData(SingletonEdmModel.GetEdmModel()); }
public static TKey GetKeyValue <TKey>(Uri uri) { if (uri == null) { throw new ArgumentNullException("uri"); } // Calculate root Uri var rootPath = uri.AbsoluteUri.Substring(0, uri.AbsoluteUri.LastIndexOf('/') + 1); var odataUriParser = new ODataUriParser(SingletonEdmModel.GetEdmModel(), new Uri(rootPath), uri); var odataPath = odataUriParser.ParsePath(); var keySegment = odataPath.LastSegment as KeySegment; if (keySegment == null) { throw new InvalidOperationException("The link does not contain a key."); } return((TKey)keySegment.Keys.First().Value); }
public static void Register(HttpConfiguration config) { config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always; config.MapODataServiceRoute("odata", "odata", SingletonEdmModel.GetEdmModel()); }