2 // System.Web.HttpApplicationState
5 // Patrik Torstensson (Patrik.Torstensson@labs2.com)
8 using System.Threading;
10 using System.Collections.Specialized;
12 namespace System.Web {
14 [MonoTODO("Performance - Use SWMR lock here")]
15 public sealed class HttpApplicationState : NameObjectCollectionBase {
16 private HttpStaticObjectsCollection _AppObjects;
17 private HttpStaticObjectsCollection _SessionObjects;
19 // TODO : Change to ReadWriteLock when ready
22 private void LockRead ()
27 private void LockWrite ()
32 private void UnlockRead ()
37 private void UnlockWrite ()
42 internal HttpApplicationState ()
44 _AppObjects = new HttpStaticObjectsCollection ();
45 _SessionObjects = new HttpStaticObjectsCollection ();
49 internal HttpApplicationState (HttpStaticObjectsCollection AppObj,
50 HttpStaticObjectsCollection SessionObj)
55 _AppObjects = new HttpStaticObjectsCollection ();
58 if (null != SessionObj) {
59 _SessionObjects = SessionObj;
61 _SessionObjects = new HttpStaticObjectsCollection ();
66 public void Add (string name, object value)
70 BaseAdd (name, value);
86 public object Get (string name)
100 public object Get (int index)
106 ret = BaseGet (index);
114 public string GetKey (int index)
120 ret = BaseGetKey (index);
133 public void Remove (string name)
143 public void RemoveAll ()
148 public void RemoveAt (int index)
152 BaseRemoveAt (index);
158 public void Set (string name, object value)
162 BaseSet (name, value);
168 public void UnLock ()
173 public string [] AllKeys {
175 string [] ret = null;
179 ret = BaseGetAllKeys ();
188 public HttpApplicationState Contents {
192 public override int Count {
207 public object this [string name] {
208 get { return Get (name); }
209 set { Set (name, value); }
212 public object this [int index] {
213 get { return Get (index); }
216 // ASP Session based objects
217 internal HttpStaticObjectsCollection SessionObjects {
218 get { return _SessionObjects; }
221 // ASP App based objects
222 public HttpStaticObjectsCollection StaticObjects {
223 get { return _AppObjects; }