TAILIEUCHUNG - ASP.NET 4 Unleased - p 102

Bạn có thể xây dựng các biểu thức LINQ để truy vấn SQL động bằng cách tận dụng các lớp . Lớp này có tất cả các phương pháp để xây dựng các biểu thức truy vấn năng động. Đây là danh sách (rất một phần) các phương pháp hỗ trợ của lớp này. | 984 CHAPTER 20 Data Access with LINQ to SQL You can build LINQ to SQL query expressions dynamically by taking advantage of the class. This class contains all the methods for building query expressions dynamically. Here is a very partial list of methods supported by this class Add Creates an expression that represents addition. And Creates an expression that represents a logical AND. Condition Creates an expression that represents a condition. Constant Creates an expression that represents a constant value. Convert Creates an expression that represents a conversion from one type to another. Divide Creates an expression that represents division. Equal Creates an expression that represents whether two expressions are equal. Field Creates an expression that represents a field. Lambda Creates a lambda expression. Multiply Creates an expression that represents multiplication. Or Creates an expression that represents a logical OR. Parameter Creates an expression that represents a function parameter. Property Creates an expression that represents accessing a property. PropertyOrField Creates an expression that represents accessing a property or field. Subtract Creates an expression that represents subtraction. Again this is not a complete list of methods supported by the Expression class. However it should give you some idea of how you can go about building expressions. Let s discuss a real-world situation in which you need dynamic LINQ to SQL expressions sorting. If you want to enable sorting when using a GridView control with LINQ to SQL you have a choice. You can create a switch SELECT CASE block to sort by every possible column that a user can click or you can create a dynamic LINQ to SQL expression. The class in Listing contains a method called GetDynamicSort that returns a dynamic lambda expression that can be used with either the OrderBy or OrderByDescending method. LISTING Standard App Code using System using

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.