Ejemplo n.º 1
0
        private void DeleteExternalReference(string refName, string assemblyFile)
        {
            refName = refName.ToLower().Trim();

            if (!System.IO.File.Exists(assemblyFile))
            {
                throw new StoredProcException(string.Format("assembly file : {0} does not exist!", assemblyFile));
            }

            switch (refName)
            {
            case "query":
                Hubble.Core.Global.IQueryConfig iqueryConfig = new Hubble.Core.Global.IQueryConfig(assemblyFile);

                Global.Setting.Config.IQuerys.Remove(iqueryConfig);
                Global.Setting.Save();
                break;

            case "analyzer":
                Hubble.Core.Global.IAnalyzerConfig ianalyzerConfig = new Hubble.Core.Global.IAnalyzerConfig(assemblyFile);

                Global.Setting.Config.IAnalyzers.Remove(ianalyzerConfig);
                Global.Setting.Save();
                break;

            case "dbadapter":
                Hubble.Core.Global.IDBAdapterConfig idbadapterConfig = new Hubble.Core.Global.IDBAdapterConfig(assemblyFile);

                Global.Setting.Config.IDBAdapters.Remove(idbadapterConfig);
                Global.Setting.Save();
                break;

            case "distinct":
                Hubble.Core.Global.IDistinctConfig idistinctConfig = new Hubble.Core.Global.IDistinctConfig(assemblyFile);

                Global.Setting.Config.IDistincts.Remove(idistinctConfig);
                Global.Setting.Save();
                break;

            default:
                throw new StoredProcException("refName must be 'Query', 'Analyzer' or 'DBAdapter");
            }
        }
Ejemplo n.º 2
0
        private void AddExternalReference(string refName, string assemblyFile)
        {
            Global.UserRightProvider.CanDo(Right.RightItem.ManageDB);

            refName = refName.ToLower().Trim();

            if (!System.IO.File.Exists(assemblyFile))
            {
                throw new StoredProcException(string.Format("assembly file : {0} does not exist!", assemblyFile));
            }


            switch (refName)
            {
            case "query":
                Hubble.Core.Global.IQueryConfig iqueryConfig = new Hubble.Core.Global.IQueryConfig(assemblyFile);

                if (Global.Setting.Config.IQuerys.Contains(iqueryConfig))
                {
                    throw new StoredProcException(string.Format("assembly file : {0} is already configured!", assemblyFile));
                }

                Global.Setting.Config.IQuerys.Add(iqueryConfig);
                Global.Setting.Save();
                break;

            case "analyzer":
                Hubble.Core.Global.IAnalyzerConfig ianalyzerConfig = new Hubble.Core.Global.IAnalyzerConfig(assemblyFile);

                if (Global.Setting.Config.IAnalyzers.Contains(ianalyzerConfig))
                {
                    throw new StoredProcException(string.Format("assembly file : {0} is already configured!", assemblyFile));
                }

                Global.Setting.Config.IAnalyzers.Add(ianalyzerConfig);
                Global.Setting.Save();
                break;

            case "dbadapter":
                Hubble.Core.Global.IDBAdapterConfig idbadapterConfig = new Hubble.Core.Global.IDBAdapterConfig(assemblyFile);

                if (Global.Setting.Config.IDBAdapters.Contains(idbadapterConfig))
                {
                    throw new StoredProcException(string.Format("assembly file : {0} is already configured!", assemblyFile));
                }

                Global.Setting.Config.IDBAdapters.Add(idbadapterConfig);
                Global.Setting.Save();
                break;

            case "distinct":
                Hubble.Core.Global.IDistinctConfig idistinctConfig = new Hubble.Core.Global.IDistinctConfig(assemblyFile);

                if (Global.Setting.Config.IDistincts.Contains(idistinctConfig))
                {
                    throw new StoredProcException(string.Format("assembly file : {0} is already configured!", assemblyFile));
                }

                Global.Setting.Config.IDistincts.Add(idistinctConfig);
                Global.Setting.Save();
                break;

            default:
                throw new StoredProcException("refName must be 'Query', 'Analyzer' or 'DBAdapter");
            }
        }