示例#1
0
 // Uncomment the method below to handle the event raised after a feature has been installed.
 //public override void FeatureInstalled(SPFeatureReceiverProperties properties)
 //{
 //}
 // Uncomment the method below to handle the event raised before a feature is uninstalled.
 /// <summary>
 /// Occurs when a Feature is uninstalled.
 /// </summary>
 /// <param name="properties">An <see cref="T:Microsoft.SharePoint.SPFeatureReceiverProperties" /> object that represents the properties of the event.</param>
 public override void FeatureUninstalling(SPFeatureReceiverProperties properties)
 {
     try
     {
         // Get the ServiceLocatorConfig service from the service locator.
         WebsiteModelExtensions.TraceEvent
             (String.Format("CAS.SmartFactory.IPR.WebsiteModel FeatureUninstalling: {0}", properties.Definition.DisplayName), 63, TraceSeverity.High, WebsiteModelExtensions.LoggingCategories.FeatureActivation);
         WebsiteModelExtensions.UnregisterLoggerSource();
     }
     catch (Exception _ex)
     {
         System.Diagnostics.EventLog.WriteEvent(SourceName, new System.Diagnostics.EventInstance(63, 0)
         {
             EntryType = System.Diagnostics.EventLogEntryType.Error
         }, _ex);
         throw;
     }
 }
示例#2
0
 /// <summary>
 /// Occurs when a Feature is uninstalled.
 /// </summary>
 /// <param name="properties">An <see cref="T:Microsoft.SharePoint.SPFeatureReceiverProperties" /> object that represents the properties of the event.</param>
 public override void FeatureUninstalling(SPFeatureReceiverProperties properties)
 {
     try
     {
         // Get the ServiceLocatorConfig service from the service locator.
         WebsiteModelExtensions.TraceEvent
             (String.Format("CAS.SmartFactory.CW.WebsiteModel FeatureUninstalling: {0}", properties.Definition.DisplayName), 76, TraceSeverity.Monitorable, WebsiteModelExtensions.LoggingCategories.FeatureActivation);
         IServiceLocator       _serviceLocator = SharePointServiceLocator.GetCurrent();
         IServiceLocatorConfig _typeMappings   = _serviceLocator.GetInstance <IServiceLocatorConfig>();
         _typeMappings.RemoveTypeMapping <ICWAccountFactory>(null);
         WebsiteModelExtensions.TraceEvent
             ("CAS.SmartFactory.CW.WebsiteModel TypeMapping removed: ICWAccountFactory", 82, TraceSeverity.High, WebsiteModelExtensions.LoggingCategories.FeatureActivation);
         WebsiteModelExtensions.UnregisterLoggerSource();
     }
     catch (Exception _ex)
     {
         System.Diagnostics.EventLog.WriteEvent(SourceName, new System.Diagnostics.EventInstance(63, 0)
         {
             EntryType = System.Diagnostics.EventLogEntryType.Error
         }, _ex);
         throw;
     }
 }