Exemple #1
0
        /// <summary>
        /// Retrieve the profile for the specified user. If the profile is cached in the database
        /// it returns the full details immediately. Otherwise it creates and returns an empty
        /// profile.
        /// </summary>
        /// <param name="username">The user whose profile is requested</param>
        /// <returns>A profile for the specified user. May be incomplete if the full profile
        /// is not cached in the database.</returns>
        public static Profile ProfileForUser(string username)
        {
            // Enforce lowercase usernames
            username = username.ToLower();

            ProfileCollection prc     = CIX.ProfileCollection;
            Profile           profile = prc.Get(username);

            if (profile == null)
            {
                profile = new Profile
                {
                    Username = username,
                };
                prc.Add(profile);
            }

            return(profile);
        }