[ Pobierz całość w formacie PDF ]
.NETUsing the SecurityCallContext ClassDelivery TipThe following example shows how use SecurityCallContext to determinePoint out that the example inwhether security is enabled, check whether a caller is in the Manager role, andthe student notes uses thereturn the AccountName string from the OriginalCaller property, which is aIsSecurityEnabled propertySecurityIdentity instance.of the ContextUtil object toavoid any exceptions_caused by security beingPublic Class Accountturned off for thisInherits ServicedComponentcomponent.This is thesame technique usedPublic Function GetDetails( ) As Stringpreviously with MTS andIf ContextUtil.IsSecurityEnabled ThenVisual Basic 6.With SecurityCallContext.CurrentCallIf.IsCallerInRole("Manager") ThenReturn.OriginalCaller.AccountNameEnd IfEnd WithEnd IfEnd FunctionEnd Class Module 9: Developing Components in Visual Basic.NET 23Using Other Component ServicesTopic ObjectiveTo provide an overview ofthe remaining servicesprovided by ComponentOther Component Services Include:Services.Just-in-time activationLead-inComponent ServicesQueued componentsprovides several otherservices that you can use inShared propertiesVisual Basic.NETcomponents.SynchronizationComponent Services provides a series of other services that you can use fromVisual Basic.NET components.Just-in-Time ActivationWhen just-in-time (JIT) activation is enabled, an object is automaticallyinstantiated when a method is called on a serviced component (activation), andthen automatically deactivated when the method is complete (deactivation).When this optio n is enabled, an object does not maintain state across methodcalls, and this increases the performance and scalability of the application.You can override the Activate and Deactivate methods inherited from theServicedComponent class to perform custom functionality during JIT.Ifobject pooling is enabled, the activation occurs when an existing object hasbeen taken from the pool, and the deactivation occurs when the object is placedback in the pool.JIT is automatically enabled if a component is transactional, and it cannot bedisabled.You can manually enable or disable JIT for non-transactionalcomponents by using the JustInTimeActivation attribute.Queued ComponentsQueued components provide asynchronous communication.This allows clientapplications to send requests to queued components without waiting for aresponse.The requests are  recorded and sent to the server, where they arequeued until the application is ready to use the requests.These requests are then played back to the application as if they were being sent from a regular client.You can mark an application for queuing by using the assembly-levelApplicationQueuing attribute.Mark individual components with theInterfaceQueuing attribute. 24 Module 9: Developing Components in Visual Basic.NETShared PropertiesYou can use the Shared Property Manger (SPM) components to shareinformation among multiple objects within the same application process.Usethe SPM components as you use them from components created inVisual Basic 6.SynchronizationDistributed applications can receive simultaneous calls from multiple clients.Managing these simultaneous requests involves complex program logic toensure that resources are accessed safely and correctly.Component Servicesprovides this service automatically to components that use transactions.Youcan also use the Synchronization attribute to specify this behavior. Module 9: Developing Components in Visual Basic.NET 25Configuring Assemblies for Component ServicesTopic ObjectiveTo explain how to set theassembly -level ComponentServices attributes andSetting Assembly Attributesconfigure the application.ApplicationNameLead-inSetting assembly-levelDescriptionComponent ServicesApplicationActivation: library or server applicationattributes helps define howyour application will behaveUsing Regsvcs to Register and Create Componentwhen you deploy it underServices ApplicationsComponent Services.Regsvcs.exe myApplication [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • czarkowski.pev.pl
  •