See Also: IRegisteredObject Members
Objects must implement the System.Web.Hosting.IRegisteredObject interface in order to register with the hosting environment and have their lifetime managed by the hosting environment.
You can create an instance of a registered object by calling the ApplicationManager.CreateObject(string, Type, string, string, bool) method on the application manager. The application manager returns the newly created object to the caller, which can then call a type-specific method on the object. During startup, the registered object should call the HostingEnvironment.RegisterObject(IRegisteredObject) method to complete registration of the object.
When the application manager needs to stop a registered object, it will call the IRegisteredObject.Stop(bool) method.
Applications can have only one instance of a registered type. To create multiple instances of a registered type, use the factory pattern to create an object manager that is registered with the application and then manages the multiple instances. For an example of an object implementing the factory pattern, see the example for the System.Web.Hosting.ApplicationManager class.