Inheritance: ICollection, ISerializable, IDeserializationCallback
Esempio n. 1
0
 public AppContext(HttpContext httpContext, string currentUserId, string currentUserName) : this(currentUserId, currentUserName)
 {
     this._SessionWrapper = new SessionWrapper(httpContext.Session);
     this._Items = httpContext.Items;
     this._Application = httpContext.Application;
     httpContext.Items[HTTP_CONTEXT_KEY] = this;
 }
Esempio n. 2
0
 public AppContext(string currentUserId, string currentUserName)
 {
     _Context = this;
     this._SessionWrapper = new SessionWrapper();
     this._Items = new Dictionary<string, object>();
     this._Application = new NameObjectCollection();
     CurrentUserId = currentUserId;
     CurrentUserName = currentUserName;
 }
Esempio n. 3
0
			internal KeysCollection(NameObjectCollectionBase collection)
			{
				this.m_collection = collection;
			}
Esempio n. 4
0
			internal _KeysEnumerator(NameObjectCollectionBase collection)
			{
				m_collection = collection;
				Reset();
			}
Esempio n. 5
0
 private string GetValueFromCookieCollection(NameObjectCollectionBase cookieCollection, object key)
 {
     return ((dynamic)cookieCollection)[key.ToString()].Value;
 }
Esempio n. 6
0
 internal NameObjectKeysEnumerator(NameObjectCollectionBase coll)
 {
     this._coll    = coll;
     this._version = this._coll._version;
     this._pos     = -1;
 }
 internal NameObjectKeysEnumerator(NameObjectCollectionBase coll)
 {
     _coll    = coll;
     _version = _coll._version;
     _pos     = -1;
 }
Esempio n. 8
0
 internal KeysCollection(NameObjectCollectionBase collection)
 {
     this.m_collection = collection;
 }
 internal NameObjectKeysEnumerator(NameObjectCollectionBase coll)
 {
     _coll = coll;
     _version = _coll._version;
     _pos = -1;
 }
		// Constructor.
		internal KeysCollection(NameObjectCollectionBase c)
				{
					this.c = c;
				}
Esempio n. 11
0
 /// <summary>
 /// Determines whether security token request contains parameter with specified key.
 /// </summary>
 /// <param name="collection">Security token request parameters.</param>
 /// <param name="key">Parameter key.</param>
 /// <returns>
 /// 	<c>true</c> if security token request contains parameter with key; otherwise, <c>false</c>.
 /// </returns>
 protected static bool ContainsKey(NameObjectCollectionBase collection, string key)
 {
     return collection.Keys.Cast<string>().Any(ckey => ckey.Equals(key, StringComparison.Ordinal));
 }
		public void SetKeys(NameObjectCollectionBase.KeysCollection val)
		{
		}
        private DataTable PopulateCollectionInfo(NameObjectCollectionBase coll)
        {
            DataTable dtData = InitDataTable(2);
            DataRow dr = null;
            int i = 0;
            System.Reflection.MemberInfo[] members = null;
            Array keys = null;
            object[] keysArray = null;
            Array values = null;
            object[] valuesArray = null;
            object valueItem = null;
            string thisValue = null;

            members = coll.GetType().FindMembers(System.Reflection.MemberTypes.Method, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance, Type.FilterName, "BaseGetAllValues");
            if (members.Length == 0)
            {
                throw new ApplicationException("Unable to retrieve values from NameObjectCollectionBase");
            }
            System.Reflection.MethodInfo mi = (System.Reflection.MethodInfo)members[0];
            values = (Array)mi.Invoke(coll, null);
            valuesArray = (object[])values;

            members = coll.GetType().FindMembers(System.Reflection.MemberTypes.Method, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance, Type.FilterName, "BaseGetAllKeys");
            if (members.Length == 0)
            {
                throw new ApplicationException("Unable to retrieve keys from NameObjectCollectionBase");
            }
            mi = (System.Reflection.MethodInfo)members[0];
            keys = (Array)mi.Invoke(coll, null);
            keysArray = (object[])keys;

            for (i = 0; i <= Information.UBound(keysArray); i++)
            {
                dr = dtData.NewRow();
                dtData.Rows.Add(dr);
                dr["Name"] = GetObjectValue(keysArray[i]);

                if (valuesArray[i] is ArrayList)
                {
                    foreach (object valueItem_loopVariable in (ArrayList)valuesArray[i])
                    {
                        valueItem = valueItem_loopVariable;
                        if (Strings.Len(thisValue) > 0)
                            thisValue += ",";
                        thisValue += GetObjectValue(valueItem);
                    }
                }
                else if (valuesArray[i] is System.Web.HttpCookie)
                {
                    thisValue = ((System.Web.HttpCookie)valuesArray[i]).Value;
                }
                else
                {
                    thisValue = GetObjectValue(valuesArray[i]);
                }

                dr["Value"] = thisValue;
            }

            return dtData;
        }
Esempio n. 14
0
 private static void XmlSerializeNameObjects(XmlWriter writer, NameObjectCollectionBase obj, Type valueType)
 {
     Type objType = obj.GetType();
     writer.WriteStartElement(GetCleanName(objType.Name));
     bool writeValueType = (valueType == null) || valueType.Equals(Generic<object>.Type);
     if (!writeValueType)
     {
         writer.WriteAttributeString("valueType", GetTypeName(valueType));
     }
     object[] values = objType.GetMethod("BaseGetAllValues", BindingFlags.NonPublic | BindingFlags.Instance, null, Type.EmptyTypes, null).Invoke(obj, null) as object[];
     for (int i = 0; i < values.Length; i++)
     {
         writer.WriteStartElement("Item");
         writer.WriteAttributeString("name", obj.Keys[i]);
         if (values[i] != null)
         {
             Type type = values[i].GetType();
             if (!((!writeValueType && (type == valueType)) || IsKnownType(type)))
             {
                 writer.WriteAttributeString("valueType", GetTypeName(type));
             }
         }
         XmlWriterSerialize(writer, values[i], valueType);
         writer.WriteEndElement();
     }
     writer.WriteEndElement();
 }
Esempio n. 15
0
 // Constructor.
 internal KeysCollection(NameObjectCollectionBase c)
 {
     this.c = c;
 }
		// Constructor.
		public KeysEnumerator(NameObjectCollectionBase c)
				{
					e = c.entries.GetEnumerator();
				}
Esempio n. 17
0
 // Constructor.
 public KeysEnumerator(NameObjectCollectionBase c)
 {
     e = c.entries.GetEnumerator();
 }
Esempio n. 18
0
        private static void BindCollection(NameObjectCollectionBase collection, object entity, ICollection<IViolation> violations)
        {
            foreach (string key in collection)
            {
                if (key == null)
                    continue;

                var violation = BindKey(key, collection, entity);

                if (violation != null)
                    violations.Add(violation);
            }
        }
Esempio n. 19
0
 internal KeysCollection(NameObjectCollectionBase coll)
 {
     _coll = coll;
 }
Esempio n. 20
0
        private static IViolation BindFile(string key, NameObjectCollectionBase collection, object entity, string propertyChain)
        {
            var file = (collection as HttpFileCollectionBase)[key];

            if (!(file.ContentLength == 0 && string.IsNullOrEmpty(file.FileName)))
                return startPropertySettingProcess(entity, propertyChain, file);

            return startPropertySettingProcess(entity, propertyChain, null);
        }
Esempio n. 21
0
 internal _KeysEnumerator(NameObjectCollectionBase collection)
 {
     m_collection = collection;
     Reset();
 }
Esempio n. 22
0
        private static IViolation BindKey(string key, NameObjectCollectionBase collection, object entity)
        {
            if (!key.StartsWith(NameDelimeter.ToString()))
                return null;

            var propertyChain = key.TrimStart(NameDelimeter);

            if (typeof (HttpFileCollectionBase).IsInstanceOfType(collection))
                return BindFile(key, collection, entity, propertyChain);

            if (typeof (NameValueCollection).IsInstanceOfType(collection))
                return startPropertySettingProcess(entity, propertyChain, (collection as NameValueCollection)[key]);

            throw new NotSupportedException();
        }
Esempio n. 23
0
 internal KeysCollection(NameObjectCollectionBase coll)
 {
     _coll = coll;
 }
 internal NameObjectKeysEnumerator(NameObjectCollectionBase coll)
 {
     this._coll = coll;
     this._version = this._coll._version;
     this._pos = -1;
 }