CHAPTER 18 THE .NET REMOTING (Apache web server tutorial) LAYER 571
CHAPTER 18 THE .NET REMOTING LAYER 571 MBR objects: The caller receives a proxy to the remote object. MBV objects: The caller receives a full copy of the object in its own application domain. If you configure an MBR object type, the CLR ensures that the transparent and real proxies are created in the client s application domain, while the MBR object itself remains in the server s application domain. As the client invokes methods on the remote type, the .NET remoting plumbing (examined previously) takes over the show and will package, pass, and return information between application domain boundaries. To be sure, MBR objects have a number of traits above and beyond their physical location. As you will see, MBR objects have various configuration options regarding their activation options and lifetime management. MBV objects, on the other hand, are local copies of remote objects (which leverage the .NET serialization protocol examined in Chapter 17). MBV objects have far fewer configuration settings, given that their lifetime is directly controlled by the client. Like any .NET object, once a client has released all references to an MBV type, it is a candidate for garbage collection. Given that MBV types are local copies of remote objects, as a client invokes members on the type, no network activity occurs during the process. Now, understand that it will be quite common for a single server to provide access to numerous MBR and MBV types. As you may also suspect, MBR types tend to support methods that return various MBV types, which gives way to the familiar factory pattern (e.g., an object that creates and returns other related objects). The next question is, how do you configure your custom class types as MBR or MBV entities? Configuring an MBV Object The process of configuring an object as an MBV type is identical to the process of configuring an object for serialization. Simply annotate the type with the [Serializable] attribute: [Serializable] public class SportsCar {…} Configuring an MBR Object MBR objects are not marked as such using a .NET attribute, but rather by deriving (directly or indirectly) from the System.MarshalByRefObject base class: public class SportsCarFactory : MarshalByRefObject {…} Formally, the MarshalByRefObject type is defined as follows: public abstract class MarshalByRefObject : object { public virtual ObjRef CreateObjRef(Type requestedType); public virtual bool Equals(object obj); public virtual int GetHashCode(); public virtual object GetLifetimeService(); public Type GetType(); public virtual object InitializeLifetimeService(); public virtual string ToString(); } Beyond the expected functionality provided by System.Object, Table 18-2 describes the role of the remaining members.
From our experience, we can recommend PHP Web Hosting services, if you need affordable webhost to host and run your web application.