public static AFConnectionHelper ConnectAndGetDatabase(string server, string databaseName, out AFDatabase database)
        {
            var manager = new AFConnectionHelper(server, databaseName);

            manager.Connect();
            database = manager.GetDatabase();
            return(manager);
        }
 public static AFConnectionHelper ConnectAndGetDatabase(string server, string databaseName, out AFDatabase database)
 {
     var manager=new AFConnectionHelper(server,databaseName);
     manager.Connect();
     database=manager.GetDatabase();
     return manager;
 }
        /// <summary>
        /// This method gets the configuration from the AF Database
        /// </summary>
        private bool GetConfiguration()
        {
            try
            {
                Logger.InfoFormat("Starting configuration");
                AFDatabase database;

                _afConnectionHelper = AFConnectionHelper.ConnectAndGetDatabase(AfServerName, AfDatabaseName, out database);

                if(!database.ElementTemplates.Contains(AfElementTemplateName))
                    throw new AFElementTemplateDoNotExistException();

                AFSDKHelpers.LoadElementsByTemplate(database, database.ElementTemplates[AfElementTemplateName], _afElementsQueue);

            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                return false;
            }

            return true;
        }