Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Sức khỏe - Y tế
Văn bản luật
Nông Lâm Ngư
Kỹ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Giới thiệu
Đăng ký
Đăng nhập
Tìm
Danh mục
Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Y tế sức khỏe
Văn bản luật
Nông lâm ngư
Kĩ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Thông tin
Điều khoản sử dụng
Quy định bảo mật
Quy chế hoạt động
Chính sách bản quyền
Giới thiệu
Đăng ký
Đăng nhập
0
Trang chủ
Công Nghệ Thông Tin
Kỹ thuật lập trình
ASP.NET 4 Unleased - p 104
Đang chuẩn bị liên kết để tải về tài liệu:
ASP.NET 4 Unleased - p 104
Diệu Linh
114
10
pdf
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Điều đầu tiên chúng ta làm trong mã này là tạo ra một thể hiện của các dịch vụ proxy, đó là một lớp tạo được thừa kế từ lớp System.Data.Services.Client.DataServiceContext. Lớp này cho thấy nhiều đặc tính cho mỗi đơn vị bộ tiếp xúc của dịch vụ. Trong trường hợp của chúng tôi, chúng tôi có những cầu thủ, vũ khí, và các sinh vật và các mối quan hệ chính nước ngoài cho phép chúng liên kết với các đăng nhập diệt | 1004 CHAPTER 21 Data Access with WCF Data Services .AddCueryOption playerId 1 .Expand Weapon .Expand Player .Expand Creature orderby kill.KillTime descending select kill killsRepeater.DataSource q killsRepeater.DataBind The first thing we do in this code is create an instance of the service proxy which is a generated class that inherits from the System.Data.Services.Client.DataServiceContext class. This class exposes properties for each of the entity sets exposed by the service. In our case we have players weapons and creatures and foreign key relationships that enable them all to link to the kill log. A Kill is another entity exposed by the service. The custom service context client proxy takes as a constructor parameter a Uri that contains the address of the service. In a production scenario you might use service discovery a service registry or Web.config files to store the URLs of the services. The next thing we do is call CreateQuery Kill GetMyKills . There s quite a bit of functionality packed into this one method call. CreateQuery doesn t actually talk to the service it is merely asking us for the shape of the rows that will be returned from the query the Kill class and for either the name of a service method to invoke or the name of an entity set to query. If we had simply supplied the string Kills to the method we would be querying the Kills entity set directly and not invoking a custom method. Next you can see that the output of the CreateQuery method is something queryable so we can chain method calls onto this method in a fluent style. We use the Expand method to tell the WCF Data Service that for every Kill we return also expand the specified relationship properties. This enables us to bring over all the data related to an entity in a single method call rather than making a bunch of chatty calls with high overhead and latency. In our case we want the names of the weapons and creatures that were killed. If we wanted we could supply virtually any .
TÀI LIỆU LIÊN QUAN
crossorigin="anonymous">
Đã 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.