예제 #1
0
        /// <summary>
        ///
        /// </summary>
        public static void RefreshServices()
        {
            ServiceConfigurationCollection svcList = null;

            foreach (ServiceProviderElement provider in _ProviderSection.Providers)
            {
                _Repository.Remove(provider.Name);
                if (provider.ProviderType == ServiceProviderType.xml)
                {
                    svcList = XmlServiceConfigurationManager.GetAllServices(provider.SourceInfo);
                }
                if (provider.ProviderType == ServiceProviderType.sqldatabase)
                {
                    svcList = DatabaseServiceConfigurationManager.GetAllServices(provider.ApplicationId, provider.SourceInfo);
                }

                try
                {
                    //Se agrega try cath debido a que un subproseso pueda intentar agregar un item y aexistente
                    _Repository.Add(provider.Name, svcList);
                }
                catch (Exception)
                { }
            }
        }
예제 #2
0
        ///date:2013-03-02 No se utilizara la actualizacion
        //private static FileSystemWatcher watcher;

        /// <summary>
        /// Obtiene todos los servicios del proveedor de metadata
        /// </summary>
        /// <param name="provider">Proveedor de la metadata</param>
        /// <returns></returns>
        public static ServiceConfigurationCollection GetAllServices(ServiceProviderElement provider)
        {
            ServiceConfigurationCollection svcList = null;

            //Si no esta cargado el provider en el repositorio
            if (!_Repository.ContainsKey(provider.Name))
            {
                #region xml

                ///date:2013-03-02 No se utilizara la actualizacion
                if (provider.ProviderType == ServiceProviderType.xml)
                {
                    //{
                    svcList = XmlServiceConfigurationManager.GetAllServices(provider.SourceInfo);
                }

                //    //Habilito FileSystemWatcher para detectar cualquie cambio sobre la metadata
                //    watcher = new System.IO.FileSystemWatcher();
                //    watcher.Filter = provider.SourceInfo;

                //    watcher.Path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location;
                //    watcher.EnableRaisingEvents = true;

                //    watcher.Changed += new FileSystemEventHandler(watcher_Changed);

                //}
                #endregion

                #region sqldatabase
                if (provider.ProviderType == ServiceProviderType.sqldatabase)
                {
                    svcList = DatabaseServiceConfigurationManager.GetAllServices(provider.ApplicationId, provider.SourceInfo);
                }
                #endregion
                try
                {
                    ///Se agrega try cath debido a que un subproseso pueda intentar agregar un item y aexistente
                    _Repository.Add(provider.Name, svcList);
                }
                catch (Exception)
                { }
            }
            else
            {
                svcList = _Repository[provider.Name];
            }

            return(svcList);
        }