[ Pobierz całość w formacie PDF ]
.Theinformation is stored in the AssemblyInfo.vb file that is part of yourVisual Basic.NET project.Assembly attribute UsageApplicationName If you use this attribute to specify the name of theapplication, a Component Services application with thesame name when your assembly is deployed and installed.Description Use this attribute to set the Component Services applicationdescription value when the assembly is deployed andinstalled.ApplicationActivation Use this attribute to specify whether you want to implementyour Component Services application as either a library ora server application.The acceptable values for this attribute areActivationOption.Server or ActivationOption.Library.Setting Assembly AttributesThe following example shows a section of an AssemblyInfo.vb file thatspecifies the application name, the description, and information about where theapplication should be activated (that is, in a server or library process). 26 Module 9: Developing Components in Visual Basic.NETRegistering Your AssemblyYou can register your assembly with Component Services either manually orautomatically.Manual registrationYou can use the Regsvcs.exe utility to manually register your assembly.This utility uses the information provided by your assembly attributes sothat the Component Services application can be created with the correctdefault information.The basic syntax for using Regsvcs.exe is shown in thefollowing example:.NET Framework Install path/Regsvcs.exe myApplication.dllAutomatic registrationIf you do not register your application manually, registration willautomatically occur when a client application attempts to create an instanceof a managed class that inherits from the ServicedComponent class.All ofthe ServicedComponent classes within your assembly will then beregistered as part of the Component Services application.This is known asLazy Registration. Module 9: Developing Components in Visual Basic.NET 27Demonstration: Creating a Serviced ComponentTopic ObjectiveTo demonstrate how tocreate a servicedcomponent.Lead-inThis demonstration showshow to create a servicedcomponent.In this demonstration, you will learn how to create a serviced component thatDelivery Tipuses object pooling and how to call the component from a managed client.The step-by-stepinstructions for thisdemonstration are in theinstructor notes for thismodule. 28 Module 9: Developing Components in Visual Basic.NETLab 9.1: Creating a Serviced ComponentTopic ObjectiveTo introduce the lab.Lead-inIn this lab, you will create aserviced component thathandles customer logoninformation.Explain the lab objectives.ObjectivesAfter completing this lab, you will be able to:Create a serviced component.Reference a serviced component.PrerequisitesBefore working on this lab, you must be familiar with creating and usingcomponents in MTS or Component Services.ScenarioIn this lab, you will create a serviced component based on a preexisting class.The class contains a single method that customers use to logon.You willregister this assembly with Component Services and create a test harnessapplication that references and tests your component.The test harness will use apreexisting form that allows you to enter a customer s e-mail address andpassword to retrieve the customer details by using the component.Starter and Solution FilesThere are starter and solution files associated with this lab.The starter files arein the install folder\Labs\Lab091\Starter folder, and the solution files are in theinstall folder\Labs\Lab091\Solution folder.Estimated time to complete this lab: 60 minutes Module 9: Developing Components in Visual Basic.NET 29Exercise 1Creating the Serviced Customer ComponentIn this exercise, you will create a serviced component.The component is basedon a prewritten interface called ICustomer and a class called Customer thatimplements the interface.You will add a reference to the EnterpriseServicesassembly and mark the class as a serviced component that requires transactionsand a construction string.You will add assembly-level attributes that will beused when you place the component under the control of Component Services.To open the CustomerComponent project1.Open Microsoft Visual Studio.NET.2.On the File menu, point to Open, and click Project.3 [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • andsol.htw.pl