Пример #1
0
        public void Connect(IDictionary <string, string> properties)
        {
            using (new LogMethodExecution(ConnectorTypeDescription + connectionId.ToString(), methodInfo.GetCurrentMethodName()))
            {
                try
                {
                    // validate & get connection properties
                    var connectionProps = ConnectionHelper.GetConnectionProperties(properties);

                    if (service == null)
                    {
                        service = new ConnectorService();
                    }

                    service.Connect(connectionProps);
                }
                catch (InvalidConnectionException)
                {
                    clearLocals();
                    throw;
                }
                catch (Exception exception)
                {
                    clearLocals();
                    unhandledExecptionHandler(methodInfo.GetCurrentMethodName(), exception);
                }
            }
        }
Пример #2
0
 private void clearLocals()
 {
     if (service != null)
     {
         service.Disconnect();
         service = null;
     }
 }
Пример #3
0
        internal MetadataProvider(ConnectorService service)
        {
            methodInfo = new MethodInfo(GetType().Name);

            if (service == null || service.IsConnected == false)
            {
                throw new ApplicationException("Must connect creating Metadata Provider");
            }

            this.service = service;
        }
Пример #4
0
        private void clearLocals()
        {
            if (metadataProvider != null)
            {
                metadataProvider.Dispose();
                metadataProvider = null;
            }

            if (service != null)
            {
                service.Disconnect();
                service = null;
            }
        }
Пример #5
0
 protected virtual void Dispose(bool disposing)
 {
     // free managed resources
     service = null;
 }