コード例 #1
0
        public IEnumerable<UserProfile> GetAllUserProfiles()
        {
            var query = @"Select {0} from UserProfile".FormatWith(sqlFields);

            using (var sql = new SqlHelper().OpenConnection())
            {
                return sql.Query<UserProfile>(query);
            }
        }
コード例 #2
0
        public UserProfile GetUserProfileByUserName(string userName)
        {
            var query = @"Select {0} from UserProfile Where UserName = @UserName".FormatWith(sqlFields);

            using (var sql = new SqlHelper().OpenConnection())
            {
                var userProfiles = sql.Query<UserProfile>(query, new { UserName = userName });
                if (userProfiles.Any())
                {
                    return userProfiles.First();
                }
            }
            return null;
        }