-
Notifications
You must be signed in to change notification settings - Fork 213
Request authentication and interception
object edited this page Feb 12, 2013
·
3 revisions
Client applications can customize HTTP requests generated by Simple.Data OData adapter in various ways. To achieve that you should pass to the initial Open method call an instance of ODataFeed instead of just a URL string. Here's the definition of ODataFeed class:
public class ODataFeed { public string Url { get; set; } public ICredentials Credentials { get; set; } public bool IncludeResourceTypeInEntryProperties { get; set; } public bool IgnoreResourceNotFoundException { get; set; } public Action<HttpWebRequest> BeforeRequest { get; set; } public Action<HttpWebResponse> AfterResponse { get; set; } // constructor overloads omitted }
Using ODataFeed properties, it's possible to enable Basic and Windows authentication, override default behavior on 404 error code (instead of throwing an exception the adapter will return null), and even assign HTTP request or response interceptors.