PrepAway - Latest Free Exam Questions & Answers

What should you do?

You work as the Microsoft.NET developer at Domain.com. The Domain.com network consists of a single Active Directory domain named Domain.com. All servers in the domain run Windows Server 2003. The development and deployment of client applications forms part of your responsibilities at Domain.com. You have received instruction to create an instance of the PropertyManager class from a client application. Following are the circumstances that you need to keep in mind in your attempts to accomplish the task at hand:
1. A class named PropertyManager exists in an assembly named PropertyManagement.dll.
2. The class and component are registered with COM+ services.
3. The COM+ application that hosts this class id configured as a server application. What should you do? (Choose the correct code segment.)

PrepAway - Latest Free Exam Questions & Answers

A.
PropertyManager propertyManager =(PropertyManager)Activator.GetObject(typeof(PropertyManager),”COM+”);

B.
PropertyManager propertyManager =(PropertyManager)AppDomain.CurrentDomain.CreateInstanceFrom(“PropertyManagement.dll”,”PropertyManager”);

C.
PropertyManager propertyManager = new PropertyManager();

D.
PropertyManager propertyManager =(PropertyManager)Activator.CreateInstanceFrom(“PropertyManagement.dll”,”PropertyManagement.PropertyManager”);

Explanation:
An instance of the PropertyManager class should be created by calling its constructor. Then the Enterprise Services infrastructure will return a proxy instance that you application uses to make calls across application domain boundaries.
Incorrect answers:
A: The GetObject method of the Activator class should not be used to create an instance of the PropertyManager class. This method will require that the remote object be accessible at a specific URL and COM+ services do not allow objects to be accessed by URL’s.
B: Albeit possible to call the CreateInstanceFrom method of the AppDomain class, you should not cast this instance to PropertyManager. It will return an instance of ObjectHandle and to obtain the real object you will need to call the Unwrap method of the ObjectHandle instance.
D: Even though it is possible to call the CreateInstanceFrom method of the Activator class, you should not cast this instance to PropertyManager. It will return an instance of ObjectHandle and to obtain the real object you will need to call the Unwrap method of the ObjectHandle instance.


Leave a Reply