GlobalObjectService Class

Maintains the current table of global object providers. This class cannot be inherited.

This API is not CLS-compliant. 

Namespace:  Microsoft.VisualStudio.Shell.Design
Assembly:  Microsoft.VisualStudio.Shell.Design (in Microsoft.VisualStudio.Shell.Design.dll)

Syntax

'Declaration
<CLSCompliantAttribute(False)> _
Public NotInheritable Class GlobalObjectService _
    Implements IDisposable
'Usage
Dim instance As GlobalObjectService
[CLSCompliantAttribute(false)]
public sealed class GlobalObjectService : IDisposable
[CLSCompliantAttribute(false)]
public ref class GlobalObjectService sealed : IDisposable
public final class GlobalObjectService implements IDisposable

Remarks

The GlobalObjectService class is queried by design-time tools to obtain information about available global objects and types. The GetGlobalObjects and GetGlobalTypes methods return collections containing the currently available global objects and global types, respectively. GlobalObjectService is commonly queried by the objects of type IReferenceService and ITypeResolutionService.

When the designer loader is initialized, it creates a single instance of the global object service which it associates with the design surface. With this arrangement, global objects can be persisted flexibly, using an arbitrary serialization scheme. Internally, the global object service performs the following duties:

  • It queries the various global object providers for global objects. Each global object returned is queried for a compatible serializer, and if none is found, that global object is discarded because it cannot be serialized.

  • It maintains a table of global objects. This table tracks which global objects came from which provider. After a global object is added to the table, the global object service listens for events on the global object.

  • When a global object’s instance is created, it adds metadata to the instance so it can be serialized. The serializer is obtained by a call to GetSerializer on the global object itself.

  • It monitors the change events for each global object. When a change event is raised the global object service raises an AssemblyObsolete event to the dynamic type service for each unique assembly. It passes an array of types into the event as well, so those listening know exactly what types are valid. This list is built up in two passes in response to the Changing and Changed events. The CodeDomDesignerLoader monitors AssemblyObsolete events and reloads the designer if the assembly contained within the event is being used by the designer.

Inheritance Hierarchy

System.Object
  Microsoft.VisualStudio.Shell.Design.GlobalObjectService

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

GlobalObjectService Members

Microsoft.VisualStudio.Shell.Design Namespace

GlobalObject

GlobalType

GlobalObjectProvider

GlobalObjectProviderFactory

System.ComponentModel.Design.IReferenceService

System.ComponentModel.Design.ITypeResolutionService

CodeDomDesignerLoader