Exemplo n.º 1
0
        /// <summary>
        /// Returns a value indicating whether the specified property has a backing member in
        /// the ASP.NET profile.
        /// </summary>
        /// <param name="propertyInfo">The property to make the determination for</param>
        /// <returns>Whether the property is in the profile</returns>
        private static bool IsInProfile(PropertyInfo propertyInfo)
        {
            bool isInProfile = true;

            ProfileUsageAttribute usageAttribute = GetProfileUsage(propertyInfo);

            if (usageAttribute != null)
            {
                isInProfile = !usageAttribute.IsExcluded;
            }

            return(isInProfile);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the profile alias for the specified property.
        /// </summary>
        /// <remarks>
        /// This is either:
        /// <para>
        /// 1) <see cref="ProfileUsageAttribute.Alias"/> when the property is marked with the attribute.
        /// 2) <see cref="MemberInfo.Name"/> for the specified property.
        /// </para>
        /// </remarks>
        /// <param name="propertyInfo">The property to get the profile alias for</param>
        /// <returns>The profile alias for the specified property</returns>
        private static string GetProfileAlias(PropertyInfo propertyInfo)
        {
            string profileAlias = propertyInfo.Name;

            ProfileUsageAttribute usageAttribute = GetProfileUsage(propertyInfo);

            if (usageAttribute != null)
            {
                if (!string.IsNullOrEmpty(usageAttribute.Alias))
                {
                    profileAlias = usageAttribute.Alias;
                }
            }

            return(profileAlias);
        }