Inheritance: ICollection, ISerializable, IDeserializationCallback
Exemple #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;
 }
Exemple #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;
 }
			internal KeysCollection(NameObjectCollectionBase collection)
			{
				this.m_collection = collection;
			}
			internal _KeysEnumerator(NameObjectCollectionBase collection)
			{
				m_collection = collection;
				Reset();
			}
 private string GetValueFromCookieCollection(NameObjectCollectionBase cookieCollection, object key)
 {
     return ((dynamic)cookieCollection)[key.ToString()].Value;
 }
Exemple #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;
 }
Exemple #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;
				}
Exemple #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;
        }
 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();
 }
Exemple #15
0
 // Constructor.
 internal KeysCollection(NameObjectCollectionBase c)
 {
     this.c = c;
 }
		// Constructor.
		public KeysEnumerator(NameObjectCollectionBase c)
				{
					e = c.entries.GetEnumerator();
				}
Exemple #17
0
 // Constructor.
 public KeysEnumerator(NameObjectCollectionBase c)
 {
     e = c.entries.GetEnumerator();
 }
Exemple #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);
            }
        }
 internal KeysCollection(NameObjectCollectionBase coll)
 {
     _coll = coll;
 }
Exemple #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);
        }
Exemple #21
0
 internal _KeysEnumerator(NameObjectCollectionBase collection)
 {
     m_collection = collection;
     Reset();
 }
Exemple #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();
        }
 internal KeysCollection(NameObjectCollectionBase coll)
 {
     _coll = coll;
 }
 internal NameObjectKeysEnumerator(NameObjectCollectionBase coll)
 {
     this._coll = coll;
     this._version = this._coll._version;
     this._pos = -1;
 }