示例#1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="provider"></param>
 public MetadataProvider(ServiceProviderElement provider)
 {
     _ApplicationId      = provider.ApplicationId;
     _ConfigProviderType = provider.ProviderType.ToString();
     _Name                 = provider.Name;
     _SourceInfo           = provider.SourceInfo;
     _SecurityProviderName = provider.SecurityProviderName;
     //_DefaultCulture = provider.DefaultCulture;
 }
        /// <summary>
        /// Agrega un nuevo proveedor si este no existe
        /// </summary>
        /// <param name="name"></param>
        /// <param name="sourceInfo"></param>
        /// <param name="applicationId"></param>
        /// <param name="type"></param>
        public void AddNewProvider(string name, string sourceInfo, string applicationId, ServiceProviderType type)
        {
            ServiceProviderElement p = new ServiceProviderElement();

            p.Name          = name;
            p.SourceInfo    = sourceInfo;
            p.ApplicationId = applicationId;
            p.ProviderType  = type;
            this.AddNewProvider(p);
        }
        /// <summary>
        /// Agrega un nuevo proveedor si este no existe
        /// </summary>
        /// <param name="newProvider"></param>
        public void AddNewProvider(ServiceProviderElement newProvider)
        {
            if (this.GetProvider(newProvider.Name) == null)
            {
                this.Providers.Add(newProvider);

                //ExeConfigurationFileMap map = new ExeConfigurationFileMap();
                //map.ExeConfigFilename = System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name + ".config";
                //map.ExeConfigFilename = AssemblyDirectory();
                //System.Configuration.Configuration configuration = ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.None);
                //ServiceProviderSection config = (ServiceProviderSection)configuration.Sections["FwkServiceMetadata"];


                //config.Providers.Add(newProvider);
                //configuration.Save(ConfigurationSaveMode.Minimal, true);
            }
        }
 /// <summary>
 /// Constructor de ConfigProviderSection.
 /// </summary>
 public ServiceProviderSection()
 {
     _ServiceProviderElement = new ServiceProviderElement();
 }
 /// <summary>
 /// Retorna el índice del proveedor de metadata.
 /// </summary>
 /// <param name="configProviderElement">ConfigProviderElement que se desea conocer su </param>
 /// <returns>índice</returns>
 public int IndexOf(ServiceProviderElement configProviderElement)
 {
     return(BaseIndexOf(configProviderElement));
 }