public void Disconnect() { if (!this.isConnected) { return; } this.container = null; this.isConnected = false; }
public bool Connect(string serviceUri) { Uri thisUri = null; if (string.IsNullOrEmpty(serviceUri)) { return(false); } bool rst = Uri.TryCreate(serviceUri, UriKind.Absolute, out thisUri); if (!rst) { return(false); } if (this.isConnected) { return(true); } try { // EIV.OData.Proxy // TODO: eifvinanciero //this.container = new ODataExample(serviceUri); this.container = new EivaFinanciero(thisUri); this.container.Format.UseJson(); this.container.SaveChangesDefaultOptions = SaveChangesOptions.ReplaceOnUpdate; this.container.SendingRequest2 += Container_SendingRequest2; this.container.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials; this.isConnected = true; return(true); } catch (Exception ex) { // TODO //this.errors.Add(ex); } return(false); }