Exemplo n.º 1
0
        //public override void FeatureActivated(SPFeatureReceiverProperties properties)
        //{
        //}
        //public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
        //{
        //}

        /// <summary>
        /// Occurs after a Feature is installed.
        /// </summary>
        /// <param name="properties">An <see cref="T:Microsoft.SharePoint.SPFeatureReceiverProperties" /> object that represents the properties of the event.</param>
        public override void FeatureInstalled(SPFeatureReceiverProperties properties)
        {
            try
            {
                if (!System.Diagnostics.EventLog.SourceExists(SourceName))
                {
                    System.Diagnostics.EventLog.CreateEventSource(new System.Diagnostics.EventSourceCreationData(SourceName, "Application"));
                }
                WebsiteModelExtensions.RegisterLoggerSource();
                WebsiteModelExtensions.TraceEvent
                    (String.Format("CAS.SmartFactory.CW.WebsiteModel FeatureInstalled: {0}", properties.Definition.DisplayName), 54, TraceSeverity.High, WebsiteModelExtensions.LoggingCategories.FeatureActivation);
                IServiceLocator       _serviceLocator = SharePointServiceLocator.GetCurrent();
                IServiceLocatorConfig _typeMappings   = _serviceLocator.GetInstance <IServiceLocatorConfig>();
                _typeMappings.RegisterTypeMapping <ICWAccountFactory, CWAccountData>();
                WebsiteModelExtensions.TraceEvent("CAS.SmartFactory.CW.WebsiteModel TypeMapping registered", 59, TraceSeverity.High, WebsiteModelExtensions.LoggingCategories.FeatureActivation);
            }
            catch (Exception _ex)
            {
                System.Diagnostics.EventLog.WriteEvent(SourceName, new System.Diagnostics.EventInstance(63, 0)
                {
                    EntryType = System.Diagnostics.EventLogEntryType.Error
                }, _ex);
                throw;
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Occurs after a Feature is activated.
 /// </summary>
 /// <param name="properties">An <see cref="T:Microsoft.SharePoint.SPFeatureReceiverProperties" /> object that represents the properties of the event.</param>
 public override void FeatureActivated(SPFeatureReceiverProperties properties)
 {
     try
     {
         if (!System.Diagnostics.EventLog.SourceExists(SourceName))
         {
             System.Diagnostics.EventLog.CreateEventSource(new System.Diagnostics.EventSourceCreationData(SourceName, "Application"));
         }
         WebsiteModelExtensions.RegisterLoggerSource();
         WebsiteModelExtensions.TraceEvent
             (String.Format("CAS.SmartFactory.IPR.WebsiteModel FeatureInstalled: {0}", properties.Definition.DisplayName), 44, TraceSeverity.High, WebsiteModelExtensions.LoggingCategories.FeatureActivation);
     }
     catch (Exception _ex)
     {
         System.Diagnostics.EventLog.WriteEvent(SourceName, new System.Diagnostics.EventInstance(63, 0)
         {
             EntryType = System.Diagnostics.EventLogEntryType.Error
         }, _ex);
         throw;
     }
 }