/// <summary>
        /// Specify the roles denied read access to
        /// a given property.
        /// </summary>
        /// <param name="propertyName">Name of the property.</param>
        /// <param name="roles">List of roles denied read access.</param>
        /// <remarks>
        /// This method may be called multiple times, with the roles in
        /// each call being added to the end of the list of denied roles.
        /// In other words, each call is cumulative, adding more roles
        /// to the list.
        /// </remarks>
        public void InstanceDenyRead(string propertyName, params string[] roles)
        {
            RolesForProperty currentRoles = InstanceRules.GetRolesForProperty(propertyName);

            foreach (string item in roles)
            {
                currentRoles.ReadDenied.Add(item);
            }
        }
        /// <summary>
        /// Specify the roles denied the right to execute
        /// a given method.
        /// </summary>
        /// <param name="propertyInfo">PropertyInfo for the method.</param>
        /// <param name="roles">List of roles denied execute access.</param>
        /// <remarks>
        /// This method may be called multiple times, with the roles in
        /// each call being added to the end of the list of denied roles.
        /// In other words, each call is cumulative, adding more roles
        /// to the list.
        /// </remarks>
        public void DenyExecute(Core.IPropertyInfo propertyInfo, params string[] roles)
        {
            RolesForProperty currentRoles = TypeRules.GetRolesForProperty(propertyInfo.Name);

            foreach (string item in roles)
            {
                currentRoles.ExecuteDenied.Add(item);
            }
        }
        /// <summary>
        /// Specify the roles denied the right to execute
        /// a given method.
        /// </summary>
        /// <param name="methodName">Name of the method.</param>
        /// <param name="roles">List of roles denied execute access.</param>
        /// <remarks>
        /// This method may be called multiple times, with the roles in
        /// each call being added to the end of the list of denied roles.
        /// In other words, each call is cumulative, adding more roles
        /// to the list.
        /// </remarks>
        public void DenyExecute(string methodName, params string[] roles)
        {
            RolesForProperty currentRoles = TypeRules.GetRolesForProperty(methodName);

            foreach (string item in roles)
            {
                currentRoles.ExecuteDenied.Add(item);
            }
        }
        /// <summary>
        /// Specify the roles denied write access to
        /// a given property.
        /// </summary>
        /// <param name="propertyName">Name of the property.</param>
        /// <param name="roles">List of roles denied write access.</param>
        /// <remarks>
        /// This method may be called multiple times, with the roles in
        /// each call being added to the end of the list of denied roles.
        /// In other words, each call is cumulative, adding more roles
        /// to the list.
        /// </remarks>
        public void DenyWrite(string propertyName, params string[] roles)
        {
            RolesForProperty currentRoles = TypeRules.GetRolesForProperty(propertyName);

            foreach (string item in roles)
            {
                currentRoles.WriteDenied.Add(item);
            }
        }
        /// <summary>
        /// Specify the roles allowed to write a given
        /// property.
        /// </summary>
        /// <param name="propertyInfo">PropertyInfo for the property.</param>
        /// <param name="roles">List of roles granted write access.</param>
        /// <remarks>
        /// This method may be called multiple times, with the roles in
        /// each call being added to the end of the list of allowed roles.
        /// In other words, each call is cumulative, adding more roles
        /// to the list.
        /// </remarks>
        public void AllowWrite(Core.IPropertyInfo propertyInfo, params string[] roles)
        {
            RolesForProperty currentRoles = TypeRules.GetRolesForProperty(propertyInfo.Name);

            foreach (string item in roles)
            {
                currentRoles.WriteAllowed.Add(item);
            }
        }
        /// <summary>
        /// Specify the roles allowed to read a given
        /// property.
        /// </summary>
        /// <param name="propertyName">Name of the property.</param>
        /// <param name="roles">List of roles granted read access.</param>
        /// <remarks>
        /// This method may be called multiple times, with the roles in
        /// each call being added to the end of the list of allowed roles.
        /// In other words, each call is cumulative, adding more roles
        /// to the list.
        /// </remarks>
        public void AllowRead(string propertyName, params string[] roles)
        {
            RolesForProperty currentRoles = TypeRules.GetRolesForProperty(propertyName);

            foreach (string item in roles)
            {
                currentRoles.ReadAllowed.Add(item);
            }
        }
        /// <summary>
        /// Specify the roles allowed to execute a given
        /// method.
        /// </summary>
        /// <param name="methodName">Name of the method.</param>
        /// <param name="roles">List of roles granted read access.</param>
        /// <remarks>
        /// This method may be called multiple times, with the roles in
        /// each call being added to the end of the list of allowed roles.
        /// In other words, each call is cumulative, adding more roles
        /// to the list.
        /// </remarks>
        public void InstanceAllowExecute(string methodName, params string[] roles)
        {
            RolesForProperty currentRoles = InstanceRules.GetRolesForProperty(methodName);

            foreach (string item in roles)
            {
                currentRoles.ExecuteAllowed.Add(item);
            }
        }
        /// <summary>
        /// Specify the roles allowed to write a given
        /// property.
        /// </summary>
        /// <param name="propertyName">Name of the property.</param>
        /// <param name="roles">List of roles granted write access.</param>
        /// <remarks>
        /// This method may be called multiple times, with the roles in
        /// each call being added to the end of the list of allowed roles.
        /// In other words, each call is cumulative, adding more roles
        /// to the list.
        /// </remarks>
        public void InstanceAllowWrite(string propertyName, params string[] roles)
        {
            RolesForProperty currentRoles = InstanceRules.GetRolesForProperty(propertyName);

            foreach (string item in roles)
            {
                currentRoles.WriteAllowed.Add(item);
            }
        }
        internal RolesForProperty GetRolesForProperty(string propertyName)
        {
            RolesForProperty currentRoles = null;

            if (!RulesList.TryGetValue(propertyName, out currentRoles))
            {
                lock (_rolesLock)
                {
                    if (!RulesList.TryGetValue(propertyName, out currentRoles))
                    {
                        currentRoles = new RolesForProperty();
                        RulesList.Add(propertyName, currentRoles);
                    }
                }
            }
            return(currentRoles);
        }