Tôi đã nhận lỗi này khi tôi sử dụng chức năng tổng hợp trong LINQ:lỗi LINQ tham số chung hoặc truy vấn phải sử dụng một loại nullable
The cast to value type 'Decimal' failed because the materialized value is null. Either the result type's generic parameter or the query must use a nullable type.
GroupProduct.Where(a => a.Product.ProductID==1).Sum(Content => Content.Amount==null?0:Content.Amount),
Câu hỏi thực tế của bạn là gì? – AnthonyWJones
Loại dữ liệu của thuộc tính Số tiền là gì? – AnthonyWJones