Candor.Security.SqlProvider.UserProvider.GetUserByID C# (CSharp) Method

GetUserByID() public method

Gets a user by identity.
public GetUserByID ( System.Guid userId ) : User
userId System.Guid The unique identity.
return Candor.Security.User
        public override User GetUserByID(Guid userId)
        {
            using (var cn = new SqlConnection(ConnectionStringUser))
            {
                cn.Open();
                using (var cmd = new SqlCommand())
                {
                    cmd.Connection = cn;
                    cmd.CommandType = System.Data.CommandType.Text;
                    cmd.CommandText = @"Select RecordID, UserID, Name, IsGuest, Password`, PasswordHashUpdatedDate, PasswordUpdatedDate, IsDeleted, CreatedDate, CreatedByUserID, UpdatedDate, UpdatedByUserID
             from Security.User
             where UserID = @UserID";
                    cmd.Parameters.AddWithValue("UserID", userId);
                    using (var reader = cmd.ExecuteReader())
                    {
                        if (reader.Read())
                        {
                            return BuildUser(reader);
                        }
                    }
                }
            }
            return null;
        }