ImageVerifierCode 换一换
格式:DOCX , 页数:12 ,大小:214.21KB ,
资源ID:9100955      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/9100955.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(Lab 5Creating a Foundational Module.docx)为本站会员(b****8)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

Lab 5Creating a Foundational Module.docx

1、Lab 5 Creating a Foundational ModuleLab 5: Creating a Foundational ModulePurposeEstimated time to complete this lab: 25 minutes.In this lab, you will use the Smart Client Development guidance package to add a foundational module to you smart client application solution. You will also create a new gl

2、obal service that will simulate a real printing service.After completing this lab, you will be able to: Understand the components of a foundational module Add a new foundational module to a smart client application using the guidance package. Create a global servicePreparationBefore proceeding with

3、this lab, you must install and configure the prerequisite software. For more information, see the topic Start Here.Open the solution for the previous lab (either the one that you created or the end solution for that lab.)Background: Foundational ModulesA foundational module is a module that either p

4、rovides services to the shell and other modules, provides a layout, or both. It does not implement a use case or contain a WorkItem. An example of a foundational module is a module that contains infrastructure services, like caching or logging services. Since a foundational module does not contain a

5、 WorkItem, all the services created within a foundational module are registered as global services with the root WorkItem. Exercise 1: Creating a New Foundational ModuleIn this exercise you create a foundational module which will provide a printing service for all the modules in the application. The

6、 ShippingModule module will consume it to print packing slips and shipping labels for sales orders.Task 1. Use the Guidance Package to add a new Foundational ModuleIn this task you will add a foundation module to your application. The guidance package includes the Visual Studio template named Add Fo

7、undational Module (C#). This template unfolds a new class library project for the module. 1. In Solution Explorer, right-click the Source solution folder, point to Smart Client Software Factory, and then click Add Foundational Module (C#). The Add New Project dialog box appears with the Add Foundati

8、onal Module (C#) template selected.2. Enter PrintingModule as the Name and set the Location to the Source folder of the solution. Click OK. The guidance package displays the Add Foundational Module wizard.Figure 1Add Foundational Module Wizard3. Deselect the option Create an interface library for th

9、is module. If you select this option, the recipe will create an additional project to contain the elements that provide the public interface to the assembly. For more information about separating the interface from the implementation of modules, see the Module Interface Separation pattern in the Sma

10、rt Client Software Factory documentation.4. Deselect the option Create a unit test project for this module. If you select this option, the recipe will create a test project for the module with test classes for your module components. In this lab you will not write unit tests for the module.5. Option

11、ally, select the option Show documentation after recipe completes if you want to see a summary of the recipe actions and suggested next steps after the recipe completes.6. Click Finish. The guidance package will generate a new class library project named PrintingModule.Figure 2 PrintingModule module

12、 in Solution ExplorerThe root folder of the project contains a class, Module. The Module class derives from the Composite UI Application Block class ModuleInit. The Composite UI Application Block calls the Load method of this class on startup.The project also contains the following folders: Constant

13、s. This folder contains four classes named CommandNames, EventTopicNames, UIExtensionSiteNames, and WorkspaceNames. You can modify these classes to define module-specific identifiers for your commands, event topics, UIExtensionSites, and WorkSpaces. Services. You use this folder to store the impleme

14、ntation of global services.The recipe also adds the following XML entry for the module to the profile catalog of the application (defined in the file ShellProfileCatalog.xml). This means that the Composite UI Application Block will load the module at application initialization time.XML The Composite

15、 UI Application Block loads modules in the order they are specified in the profile catalog file, unless you explicitly define inter-module dependencies. Thus, the ShippingModule module will be loaded before the PrintingModule. This might lead to problems if the ShippingModule instantiates a service

16、during module initialization that has a dependency in a component that belongs to the PrintingService module. To avoid this problem, you can specify module dependencies by arranging modules into sections and establishing dependencies between the sections. When you create a smart client solution, two

17、 sections are defined by default: Services. Include in this section modules that expose global services to other modules. Typically you will include foundational modules in this section. Apps. Include in this section modules that might have dependencies on services published by other modules. Typica

18、lly you will include business modules in this section.In the next step you will move the PrintingModule module to the Services section so that the Composite UI Application Block loads it before the ShippingModule module.7. Move the element for the PrintingModule module into the Services section, as

19、shown in the following code.XMLSolutionProfile xmlns= Note: You can also define dependencies for a particular module in code using the ModuleDependency attribute. For more information, see Creating a Module in the Smart Client Software Factory help.Task 2. Move Business Entities to Infrastructure.In

20、terface projectIn the next task (Task 3) you will add a printing service to the PrintingModule module. This service will simulate the printing of a sales order, thus its methods will receive an Order entity as a parameter. Since the Order class is defined in the ShippingModule project, you would nee

21、d to add a reference to it in the PrintingModule project. To avoid having a reference to the ShippingModule project in the PrintingModule project, in this task you will move the Order and OrderLineItem entities to the Infrastructure.Interface project.8. In Solution Explorer, select the Order.cs and

22、OrderLineItem.cs files in the BusinessEntities folder of the ShippingModule project, cut them, and paste them in the BusinessEntities folder in the Infrastructure.Interface project.Even though you moved the source code files to the Infrastructure.Interface project, the classes namespace is still Adv

23、entureWorks.ShippingModule.BusinessEntities. In the following steps you will rename the namespace to AdventureWorks.Infrastructure.Interface.BusinessEntities.9. Go to the Edit menu, point to Find and Replace and then select Quick Replace.10. Set AdventureWorks.ShippingModule.BusinessEntities in the

24、Find what field.11. Set AdventureWorks.Infrastructure.Interface.BusinessEntities in the Replace with field.12. In the Look in drop down list, set Entire Solution. 13. Click Replace All. 13 occurrences should be replaced.Task 3. Implement the printing serviceIn this task you will create a simple prin

25、ting service that will be consumed by the ShipNewOrderView view. 14. In Solution Explorer, right-click the Services folder in the PrintingModule project, point to Add and then click New Item. 15. From the Templates window, select Interface and set the name to IPrintingService.16. Click Add.17. Add t

26、he following using statement to the file. You will use it to refer to the Order and OrderLineItem classes.C#using AdventureWorks.Infrastructure.Interface.BusinessEntities;18. Change the interface signature to make it public:C#public interface IPrintingService19. Add a method named PrintPackingSlip t

27、o the interface body. This method will be used to print the packing slips for an order. C#void PrintPackingSlip(Order order);20. Add a method named PrintShippingLabels to the interface body. This method will be used to print the shipping labes for an order.C#void PrintShippingLabels(Order order);21.

28、 In Solution Explorer, right-click the Services folder in the PrintingModule project, point to Add and then click Class.22. Set the class name to LocalPrintingService and then click Add.23. Add the following using statements at the top of the file:C#using System.Windows.Forms;using AdventureWorks.In

29、frastructure.Interface.BusinessEntities;24. Change the class signature to make it public and to implement the IPrintingService interface:C#public class LocalPrintingService : IPrintingService25. Implement the PrintPackingSlip method. In this method, display a message box as demonstrated in the follo

30、wing code.C#public void PrintPackingSlip(Order order) MessageBox.Show(String.Format(Packing slip for Order # 0 sent to printer., order.OrderId.ToString();26. Implement the PrintShippingLabels method. In this method, display a message box as shown in the following code.C#public void PrintShippingLabels(Order order) MessageBox.Show(String.Format(Shipping labels for Order # 0 sent to printer., order.OrderId.ToString();Task 4. Register the Printing Service as a Global ServiceIn this task, you will register the printing serv

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1