RegistrationAttribute.RegistrationContext Class
An abstract base class that provides context information from an external source to a registration attribute.
Inheritance Hierarchy
System.Object
Microsoft.VisualStudio.Shell.RegistrationAttribute.RegistrationContext
Namespace: Microsoft.VisualStudio.Shell
Assembly: Microsoft.VisualStudio.Shell.Immutable.10.0 (in Microsoft.VisualStudio.Shell.Immutable.10.0.dll)
Syntax
'宣告
Public MustInherit Class RegistrationContext
public abstract class RegistrationContext
The RegistrationAttribute.RegistrationContext type exposes the following members.
Constructors
Name | Description | |
---|---|---|
RegistrationAttribute.RegistrationContext | Creates a new RegistrationAttribute.RegistrationContext. |
Top
Properties
Name | Description | |
---|---|---|
CodeBase | Gets the path and filename of the object being registered. | |
ComponentPath | Gets the path to the component that is being registered. | |
ComponentType | Gets the type of component being registered. | |
InprocServerPath | Gets the path to the in-process server DLL. | |
Log | Gets a TextWriter object that can be used to log events during registration. | |
RegistrationMethod | Gets a value that specifies how the assembly should be located (CodeBase or Assembly). | |
RootFolder | Gets or sets the root folder. |
Top
Methods
Name | Description | |
---|---|---|
CreateKey | Creates a new registration key by name. | |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
EscapePath | Reformats a string as needed by the registration tool. | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
RemoveKey | Removes an existing registration key. | |
RemoveKeyIfEmpty | Removes the key of the specified name if it has no child key and no value. | |
RemoveValue | Removes a value from a registration key. | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Top
Remarks
When to Implement
Registration tools (such as CreatePkgDef.exe) that use the information provided by the registration attribute classes must implement this class, RegistrationAttribute.RegistrationContext, as well as RegistrationAttribute.Key.
Basic Usage
A RegistrationAttribute.RegistrationContext object is created by a registration utility such as CreatePkgDef or the Windows Installer to provide information to a registration attribute. The registration context includes the type of object that is being registered, the object's path, and helper properties. It is also used to create keys that can be used to write registration information.
When the registration utility registers a managed package assembly, it uses reflection to search the assembly for attribute classes that implement the RegistrationAttribute class. A RegistrationAttribute.Key object is placed into the RegistrationAttribute.RegistrationContext object and passed to the Register (or Unregister) method of the attribute class.
The attribute class uses the information in the RegistrationAttribute.Key and RegistrationAttribute.RegistrationContext objects to actually carry out the registration tasks required by the attribute.
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
Microsoft.VisualStudio.Shell Namespace
RegistrationAttribute.RegistrationContext