/// <include file='doc\ProvideObjectAttribute.uex' path='docs/doc[@for="Register"]' />
        /// <devdoc>
        ///     Called to register this attribute with the given context.  The context
        ///     contains the location where the registration inforomation should be placed.
        ///     it also contains such as the type being registered, and path information.
        ///
        ///     This method is called both for registration and unregistration.  The difference is
        ///     that unregistering just uses a hive that reverses the changes applied to it.
        /// </devdoc>
        public override void Register(RegistrationContext context)
        {
            context.Log.WriteLine(SR.GetString(SR.Reg_NotifyToolboxItemConfiguration, ObjectType.Name));

            using (Key childKey = context.CreateKey(CLSIDRegKey))
            {
                childKey.SetValue(string.Empty, ObjectType.FullName);
                childKey.SetValue("InprocServer32", context.InprocServerPath);
                childKey.SetValue("Class", ObjectType.FullName);
                if (context.RegistrationMethod == RegistrationMethod.CodeBase)
                {
                    childKey.SetValue("Codebase", context.CodeBase);
                }
                else
                {
                    childKey.SetValue("Assembly", ObjectType.Assembly.FullName);
                }
                childKey.SetValue("ThreadingModel", "Both");
            }

            string guid = ObjectType.GUID.ToString("B");

            // Now, look up the object type and look for assembly filters.
            foreach (object attr in ObjectType.GetCustomAttributes(typeof(ProvideAssemblyFilterAttribute), true))
            {
                ProvideAssemblyFilterAttribute filter = (ProvideAssemblyFilterAttribute)attr;
                context.Log.WriteLine(SR.GetString(SR.Reg_NotifyToolboxItemFilter, filter.AssemblyFilter));
                using (Key itemCfgKey = context.CreateKey(GetItemCfgFilterKey(filter.AssemblyFilter)))
                {
                    itemCfgKey.SetValue(ObjectType.FullName, guid);
                }
            }
        }
        public override void Unregister(RegistrationContext context)
        {
            context.RemoveKey(CLSIDRegKey);

            // Now, look up the object type and remove assembly filters.
            foreach (object attr in ObjectType.GetCustomAttributes(typeof(ProvideAssemblyFilterAttribute), true))
            {
                ProvideAssemblyFilterAttribute filter = (ProvideAssemblyFilterAttribute)attr;
                context.RemoveKey(GetItemCfgFilterKey(filter.AssemblyFilter));
            }
        }