public override Boolean IsValid(Object value) { Type objectType = value.GetType(); PropertyInfo piUser = objectType.GetProperties() .Where(p => p.Name == UserIdField) .FirstOrDefault(); PropertyInfo piEmail = objectType.GetProperties() .Where(p => p.Name == EmailField) .FirstOrDefault(); if (piUser == null || piEmail == null) { throw new ApplicationException("UniqueUserEmailAttribute error on " + objectType.Name); } int uid = Convert.ToInt32(piUser.GetValue(value, null)); string email = Convert.ToString(piEmail.GetValue(value, null)); UserService service = new UserService(); return service.IsAvailableEmail(uid, email); }