Example #1
0
        public IDatabaseManager GetDatabaseManager(ServerConnectionSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            ServerVersionId  version = settings.ServerVersion;
            IDatabaseManager dbMan;

            //Export<IDatabaseManager>
            foreach (var expmanager in DbManagers)
            {
                string dbVersion = expmanager.Metadata.DatabaseVersion;
                //      string dbVersion = ServerVersionMetaData.GetMetadataString(expmanager, "DatabaseVersion");
                // IDatabaseManager manager = expman.GetExportedObject();
                if (dbVersion == version.VersionId)
                {
                    dbMan          = expmanager.Value;
                    dbMan.Settings = settings;
                    return(dbMan);
                }
            }
            throw new SQL8rException(string.Format("DbManager not loaded: {0}", version));
        }
Example #2
0
        public IList <ServerVersionId> GetSupportedVendors()
        {
            if (DbManagers == null)
            {
                throw new SQL8rException("No DatabaseManagers loaded");
            }

            IList <ServerVersionId> vendors = new List <ServerVersionId>();

            foreach (var dbmanager in DbManagers)
            {
//			    IDatabaseManager o = expmanager.GetExportedObject();
                bool   isPublished = dbmanager.Metadata.IsPublished;
                string dbVersion   = dbmanager.Metadata.DatabaseVersion;
                if (isPublished)
                {
                    vendors.Add(ServerVersionId.Parse(dbVersion));
                }
            }

            return(new ReadOnlyCollection <ServerVersionId>(vendors));
        }
Example #3
0
        public ITemplateManager GetSqlTemplateManager(ServerConnectionSettings settings)
        {
            if (settings == null)
            {
                throw new SQL8rException("No TemplateManager available, please connect to a server first");
            }

            ServerVersionId  version = settings.ServerVersion;
            ITemplateManager dbMan;

            foreach (var tmanager in TManagers)
            {
                string dbVersion = tmanager.Metadata.DatabaseVersion;
//                ITemplateManager manager = expmanager.GetExportedObject();
                if (dbVersion == version.VersionId)
                {
                    dbMan          = tmanager.Value;
                    dbMan.Settings = settings;
                    return(dbMan);
                }
            }

            throw new SQL8rException(string.Format("TManager not loaded: {0}", version));
        }