Ejemplo n.º 1
0
        bool GetCommonAttributes(SettingsMappingWhatContents how, out string name, out string type)
        {
            name = type = null;

            Dictionary <string, string> attrs = how.Attributes;

            if (attrs == null || attrs.Count == 0)
            {
                return(false);
            }

            if (!attrs.TryGetValue("name", out name))
            {
                return(false);
            }

            if (String.IsNullOrEmpty(name))
            {
                return(false);
            }

            attrs.TryGetValue("type", out type);

            return(true);
        }
Ejemplo n.º 2
0
        void SetProviderProperties(SettingsMappingWhatContents how, ProviderSettings prov)
        {
            Dictionary <string, string> attrs = how.Attributes;

            if (attrs == null || attrs.Count == 0)
            {
                return;
            }

            string key;

            foreach (KeyValuePair <string, string> kvp in attrs)
            {
                key = kvp.Key;
                if (key == "name")
                {
                    continue;
                }
                if (key == "type")
                {
                    prov.Type = kvp.Value;
                    continue;
                }
                prov.Parameters [key] = kvp.Value;
            }
        }
        void RemoveAssembly(CompilationSection section, SettingsMappingWhatContents how)
        {
            Dictionary <string, string> attrs = how.Attributes;
            if (attrs == null || attrs.Count == 0)
                return;

            string assemblyName;
            if (!attrs.TryGetValue ("assembly", out assemblyName))
                return;

            section.Assemblies.Remove (assemblyName);
        }
Ejemplo n.º 4
0
        void ProcessReplace(MembershipSection section, SettingsMappingWhatContents how)
        {
            string name, type;

            if (!GetCommonAttributes(how, out name, out type))
            {
                return;
            }

            ProviderSettings provider = section.Providers [name];

            if (provider != null)
            {
                SetProviderProperties(how, provider);
            }
        }
Ejemplo n.º 5
0
		bool GetCommonAttributes (SettingsMappingWhatContents how, out string name, out string type)
		{
			name = type = null;
			
			Dictionary <string, string> attrs = how.Attributes;
			
			if (attrs == null || attrs.Count == 0)
				return false;

			if (!attrs.TryGetValue ("name", out name))
				return false;

			if (String.IsNullOrEmpty (name))
				return false;

			attrs.TryGetValue ("type", out type);

			return true;
		}
        void AddControl(PagesSection section, SettingsMappingWhatContents how)
        {
            Dictionary <string, string> attrs = how.Attributes;
            if (attrs == null || attrs.Count == 0)
                return;

            string tagPrefix, nameSpace, asm, tagName, source;
            if (!attrs.TryGetValue ("tagPrefix", out tagPrefix))
                tagPrefix = String.Empty;
            if (!attrs.TryGetValue ("namespace", out nameSpace))
                nameSpace = String.Empty;
            if (!attrs.TryGetValue ("assembly", out asm))
                asm = String.Empty;
            if (!attrs.TryGetValue ("tagName", out tagName))
                tagName = String.Empty;
            if (!attrs.TryGetValue ("src", out source))
                source = String.Empty;

            TagPrefixInfo info = new TagPrefixInfo (tagPrefix, nameSpace, asm, tagName, source);
            section.Controls.Add (info);
        }
Ejemplo n.º 7
0
        void ProcessRemove(MembershipSection section, SettingsMappingWhatContents how)
        {
            string name, type;

            if (!GetCommonAttributes(how, out name, out type))
            {
                return;
            }

            ProviderSettingsCollection providers = section.Providers;
            ProviderSettings           provider  = providers [name];

            if (provider != null)
            {
                if (provider.Type != type)
                {
                    return;
                }
                providers.Remove(name);
            }
        }
Ejemplo n.º 8
0
        void ProcessAdd(MembershipSection section, SettingsMappingWhatContents how)
        {
            string name, type;

            if (!GetCommonAttributes(how, out name, out type))
            {
                return;
            }

            ProviderSettingsCollection providers = section.Providers;
            ProviderSettings           provider  = providers [name];

            if (provider != null)
            {
                return;
            }

            ProviderSettings prov = new ProviderSettings(name, type);

            SetProviderProperties(how, prov);

            providers.Add(prov);
        }
Ejemplo n.º 9
0
		void ProcessClear (RoleManagerSection section, SettingsMappingWhatContents how)
		{
			section.Providers.Clear ();
		}
Ejemplo n.º 10
0
		void ProcessReplace (RoleManagerSection section, SettingsMappingWhatContents how)
		{
			string name, type;
			if (!GetCommonAttributes (how, out name, out type))
				return;

			ProviderSettings provider = section.Providers [name];
			if (provider != null)
				SetProviderProperties (how, provider);
		}
Ejemplo n.º 11
0
		void ProcessAdd (RoleManagerSection section, SettingsMappingWhatContents how)
		{
			string name, type;
			if (!GetCommonAttributes (how, out name, out type))
				return;

			ProviderSettingsCollection providers = section.Providers;
			ProviderSettings provider = providers [name];
			if (provider != null)
				return;

			ProviderSettings prov = new ProviderSettings (name, type);
			SetProviderProperties (how, prov);
			
			providers.Add (prov);
		}
Ejemplo n.º 12
0
		void ProcessRemove (RoleManagerSection section, SettingsMappingWhatContents how)
		{
			string name, type;
			if (!GetCommonAttributes (how, out name, out type))
				return;

			ProviderSettingsCollection providers = section.Providers;
			ProviderSettings provider = providers [name];
			if (provider != null) {
				if (provider.Type != type)
					return;
				providers.Remove (name);
			}
		}
 void ProcessClear(RoleManagerSection section, SettingsMappingWhatContents how)
 {
     section.Providers.Clear();
 }
Ejemplo n.º 14
0
 void ProcessAdd(string val, PagesSection section, SettingsMappingWhatContents how)
 {
     if (val == "controls")
         AddControl (section, how);
 }
Ejemplo n.º 15
0
 void ProcessClear(MembershipSection section, SettingsMappingWhatContents how)
 {
     section.Providers.Clear();
 }
Ejemplo n.º 16
0
 void ProcessRemove(string val, CompilationSection section, SettingsMappingWhatContents how)
 {
     if (val == "assemblies")
         RemoveAssembly (section, how);
 }
Ejemplo n.º 17
0
 void ProcessClear(string val, PagesSection section, SettingsMappingWhatContents how)
 {
     if (val == "controls")
         section.Controls.Clear ();
     else if (val == "tagMapping")
         section.TagMapping.Clear ();
 }
Ejemplo n.º 18
0
		void SetProviderProperties (SettingsMappingWhatContents how, ProviderSettings prov)
		{
			Dictionary <string, string> attrs = how.Attributes;
			if (attrs == null || attrs.Count == 0)
				return;

			string key;
			foreach (KeyValuePair <string, string> kvp in attrs) {
				key = kvp.Key;
				if (key == "name")
					continue;
				if (key == "type") {
					prov.Type = kvp.Value;
					continue;
				}
				prov.Parameters [key] = kvp.Value;
			}
		}
Ejemplo n.º 19
0
		void ProcessClear (MembershipSection section, SettingsMappingWhatContents how)
		{
			section.Providers.Clear ();
		}