예제 #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;
     }
 }
        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;
        }
 protected virtual void Dispose(bool disposing)
 {
     // free managed resources
     service = null;
 }