Mercurial > altnet-hispano
annotate Agendas/trunk/src/Agendas.Web/PublicadoresConfig.cs @ 128:1e47bf408073
Asignacion de los publicadores configurados en web.config al factory de agenda
(mediante CompositePublicador)
author | jorge.rowies |
---|---|
date | Mon, 04 Jul 2011 20:00:51 -0300 |
parents | 3700b77ed455 |
children |
rev | line source |
---|---|
127 | 1 using System; |
2 using System.Collections.Generic; | |
3 using System.Configuration; | |
4 using System.Linq; | |
5 using System.Web; | |
6 using System.Reflection; | |
7 | |
8 namespace AltNetHispano.Agendas.Web | |
9 { | |
10 public class PublicadorConfigurationElement : ConfigurationElement | |
11 { | |
12 [ConfigurationProperty("name", IsRequired = true)] | |
13 public string Name | |
14 { | |
15 get { return (string)this["name"]; } | |
16 } | |
17 | |
128
1e47bf408073
Asignacion de los publicadores configurados en web.config al factory de agenda
jorge.rowies
parents:
127
diff
changeset
|
18 [ConfigurationProperty("componentKey", IsRequired = true)] |
1e47bf408073
Asignacion de los publicadores configurados en web.config al factory de agenda
jorge.rowies
parents:
127
diff
changeset
|
19 public string ComponentKey |
127 | 20 { |
21 get | |
22 { | |
128
1e47bf408073
Asignacion de los publicadores configurados en web.config al factory de agenda
jorge.rowies
parents:
127
diff
changeset
|
23 return (string)this["componentKey"]; |
127 | 24 } |
25 } | |
26 | |
27 [ConfigurationProperty("enabled", IsRequired = true)] | |
28 public bool Enabled | |
29 { | |
30 get { return (bool)this["enabled"]; } | |
31 } | |
32 } | |
33 | |
34 [ConfigurationCollection(typeof(PublicadorConfigurationElement))] | |
35 public class PublicadorConfigurationCollection : ConfigurationElementCollection | |
36 { | |
37 protected override ConfigurationElement CreateNewElement() | |
38 { | |
39 return new PublicadorConfigurationElement(); | |
40 } | |
41 | |
42 protected override object GetElementKey(ConfigurationElement element) | |
43 { | |
44 var value = element as PublicadorConfigurationElement; | |
45 return value != null ? value.Name : null; | |
46 } | |
47 | |
48 public PublicadorConfigurationElement this[int index] | |
49 { | |
50 get | |
51 { | |
52 return BaseGet(index) as PublicadorConfigurationElement; | |
53 } | |
54 set | |
55 { | |
56 if (BaseGet(index) != null) | |
57 BaseRemoveAt(index); | |
58 BaseAdd(index, value); | |
59 } | |
60 } | |
61 | |
62 public new PublicadorConfigurationElement this[string name] | |
63 { | |
64 get | |
65 { | |
66 return BaseGet(name) as PublicadorConfigurationElement; | |
67 } | |
68 } | |
69 } | |
70 | |
71 public class PublicadorConfigurationSection : ConfigurationSection | |
72 { | |
73 [ConfigurationProperty("publicadores", IsRequired = true)] | |
74 public PublicadorConfigurationCollection Publicadores | |
75 { | |
76 get | |
77 { | |
78 return this["publicadores"] | |
79 as PublicadorConfigurationCollection; | |
80 } | |
81 } | |
82 } | |
83 } |