private static Func <HttpRequestMessage, IEdmModel> GetModelFuncFromRequest() { return(request => { string odataPath = request.Properties[Constants.CustomODataPath] as string ?? string.Empty; string[] segments = odataPath.Split('/'); string odataEndpoint = segments[0]; request.Properties[Constants.ODataEndpoint] = odataEndpoint; request.Properties[Constants.CustomODataPath] = string.Join("/", segments, 1, segments.Length - 1); var modelBuilder = new EdmModelBuilder(new SchemaReader(odataEndpoint)); IEdmModel model = modelBuilder.GetModel(); return model; }); }