Which attribute would you use to validate that a property is a valid email address format?
4 phương ánCó giải thíchTrung bình
Các phương án trả lời
Chọn một phương ánLời giảiChọn phương án để mở
Để xác định một thuộc tính là một địa chỉ email hợp lệ, bạn cần sử dụng thuộc tính [EmailAddress]. Đây là thuộc tính được sử dụng để xác minh rằng giá trị nhập vào có đúng định dạng email. Ví dụ, khi bạn nhập vào địa chỉ email như '[email protected]', thuộc tính [EmailAddress] sẽ xác nhận rằng nó có đúng định dạng và không có lỗi. Ngoài ra, bạn cũng có thể sử dụng thuộc tính [IsEmail] để thực hiện chức năng tương tự, nhưng [EmailAddress] là lựa chọn phổ biến hơn và được sử dụng rộng rãi trong các ứng dụng.
Cùng chương 4
A controller action needs to return a "Not Found" response when a resource does not exist. Which of the following is the best way to achieve this? [HttpGet("{id}")] public ActionResult<Product> GetProduct(int id) { var product = _productService.GetById(id); if (product == null) { return ???; // What should be here? } return product; }Câu hỏiAccording to inference rules, any complex type parameter NOT registered in the DI container and NOT matching a route parameter will be inferred as coming from where?Có lời giảiCâu hỏiBy default, where does the model binder attempt to get the data for a complex type parameter (like a class or record) in an [ApiController] action?Có lời giảiCâu hỏiCả 19 câu của chủ đề19 câu