[FSC]Apress Pro Entity Framework 4.0_9

Figure 11-6. The AWService WCF Service When the Data Service is added to our project, the associated .cs file will automatically be displayed in the IDE. Figure 11-7 shows that file, and what the Data Service template has generated for us. The result is basically the beginning of our data service. | CHAPTER 11 N-TIER DEVELOPMENT WITH WCF DATA SERVICES Solution Explorer - -p X Ql ElEll WebApplicationl t Properties t Bi References t o Account Qj App_Data t Scripts t Styles âẵ a a ul t 1 1 n Figure 11 -6. The AWService WCF Service When the Data Service is added to our project the associated .cs file will automatically be displayed in the IDE. Figure 11-7 shows that file and what the Data Service template has generated for us. The result is basically the beginning of our data service. Figure 11-7. Data Service shell As you can see in Figure 11-7 the template also generates some instructions for us which provide us some direction as to what we need to do next. The first thing we need to do is wire up our data service to our data model so that the service knows where to get its data. We know where to do this because as 193 CHAPTER 11 N-TIER DEVELOPMENT WITH WCF DATA SERVICES you can see in the highlighted code in Figure 11-7 the code tells us where. Thus replace the code comment with the name of the AdventureWorksEntities see the note a few pages back regarding this value . When you have made the change the public class line of code will look like the following public class AWService DataService AdventureWorksEntities Wiring up our data service to the model is as simple as that. Believe it or not we are ready to test our service. Testing the WCF Data Service Testing our WCF Data Service provides us not only the chance to see if our little application works but also the opportunity to explore some of the WCF Data Service functionality and the interaction between EF and the WCF Data Service. You will also see why we built this project in an Web Application. Press Ctrl F5 to compile and run the project. When the project runs the web browser will open and display what you see in Figure 11-8. Figure 11 -8. Initial test results

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
476    17    1    27-11-2024
Đã 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.