GlobalObjectService Class

 

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

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

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

[CLSCompliantAttribute(false)]
public sealed class GlobalObjectService : IDisposable

NameDescription
System_CAPS_pubmethodGlobalObjectService(IServiceProvider, Project, Type)

Initializes an new instance of the GlobalObjectService class

NameDescription
System_CAPS_pubmethodEquals(Object)

(Inherited from Object.)

System_CAPS_pubmethodGetGlobalObjects()

Returns a collection of all the currently available global objects.

System_CAPS_pubmethodGetGlobalObjects(Type)

Returns a collection of currently available global objects that are of the specified type.

System_CAPS_pubmethodGetGlobalTypes()

Returns a collection of currently available global types.

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_pubmethodToString()

(Inherited from Object.)

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodIDisposable.Dispose()

Disposes GlobalObjectService.

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.

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

Return to top
Show: