コード例 #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;
            }
        }
コード例 #2
0
 private static void registerTypeMappings(IServiceLocatorConfig typeMappings)
 {
     LogUtility logger = new LogUtility();
     logger.TraceDebugInformation("starting registerTypeMappings", typeof(ServiceLocationRegistration));
     typeMappings.RegisterTypeMapping<IServiceLocatorConfig, ServiceLocatorConfig>();
     typeMappings.RegisterTypeMapping<IAddSandboxedSolutions, AddSandboxedSolutions>();
     typeMappings.RegisterTypeMapping<IContentTypeOperations, ContentTypeOperations>();
     typeMappings.RegisterTypeMapping<IDocIconOperations, DocIconOperations>();
     typeMappings.RegisterTypeMapping<IFeatureActivator, FeatureActivator>();
     typeMappings.RegisterTypeMapping<IFieldOperations, FieldOperations>();
     typeMappings.RegisterTypeMapping<IListOperations, ListOperations>();
     //typeMappings.RegisterTypeMapping<ILogUtility, SPListLogger>();
     typeMappings.RegisterTypeMapping<ILogUtility, LogUtility>();
     typeMappings.RegisterTypeMapping<IManagedMetaDataOperations, ManagedMetaDataOperations>();
     typeMappings.RegisterTypeMapping<IModifyContentType, ModifyContentType>();
     typeMappings.RegisterTypeMapping<IViewOperations, ModifyViewClass>();
     typeMappings.RegisterTypeMapping<INavigationCustomization, NavigationCustomization>();
     typeMappings.RegisterTypeMapping<ISiteColumnOperations, SiteColumnOperations>();
     typeMappings.RegisterTypeMapping<ISPFileOperations, SPFileOperations>();
     typeMappings.RegisterTypeMapping<ISPUserOperations, SPUserOperations>();
     typeMappings.RegisterTypeMapping<ITimerJobOperations, TimerJobOperations>();
     typeMappings.RegisterTypeMapping<IWebPartOperations, WebPartOperations>();
     typeMappings.RegisterTypeMapping<IWorkflowOperations, WorkflowOperations>();
     typeMappings.RegisterTypeMapping<IFaceBookGraphAPIOperations, FaceBookGraphAPIOperations>();
     typeMappings.RegisterTypeMapping<IWorkflowMessageParser, WorkflowMessageParser>();
     typeMappings.RegisterTypeMapping<IUserParser, UserParser>();
     typeMappings.RegisterTypeMapping<ISLAMConfigurationGenerator, SLAMConfigurationGenerator>();
     typeMappings.RegisterTypeMapping<IListTemplateFinder, ListTemplateFinder>();
     typeMappings.RegisterTypeMapping<IWikiPagesOperations, WikiPagesOperations>();
     typeMappings.RegisterTypeMapping<IContentOrganizerRuleCreationData, ContentOrganizerRuleCreationData>();
     typeMappings.RegisterTypeMapping<IContentOrganizerConditionalData, ContentOrganizerConditionalData>();
     typeMappings.RegisterTypeMapping<IContentOrganizerCreator, ContentOrganizerCreator>();
     typeMappings.RegisterTypeMapping<ICustomContentOrganizerRouterRegistrar, CustomContentOrganizerRouterRegistrar>();
     typeMappings.RegisterTypeMapping<ILinkToDocumentCreator, LinkToDocumentCreator>();
     logger.TraceDebugInformation("Finishing registerTypeMappings", typeof(ServiceLocationRegistration));
 }
コード例 #3
0
        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            try
            {
                IServiceLocator       serviceLocator = SharePointServiceLocator.GetCurrent();
                IServiceLocatorConfig typeMappings   = serviceLocator.GetInstance <IServiceLocatorConfig>();

                //SPSite site = properties.Feature.Parent as SPSite;
                SPWeb web = properties.Feature.Parent as SPWeb;
                typeMappings.Site = web.Site;
                typeMappings.RegisterTypeMapping <ILicenseRepository, LicenseRepository>();
                typeMappings.RegisterTypeMapping <IPageLayoutRepository, PageLayoutRepository>();
                typeMappings.RegisterTypeMapping <IMasterPageRepository, MasterPageRepository>();
                typeMappings.RegisterTypeMapping <IKeywordRepository, KeywordRepository>();
                web.Update();
            }
            catch (Exception ex)
            {
                SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory(ex.Source, TraceSeverity.High, EventSeverity.Error), TraceSeverity.High, ex.Message, ex.Data);
                //ex.ToString();
            }

            try
            {
                SPWeb web = properties.Feature.Parent as SPWeb;

                if (web.WebTemplate.ToLower() == "websiteroot")
                {
                    //Hemrika.SharePresence.WebSite.Modules.WebPageModule.WebPageModule, Hemrika.SharePresence.WebSite, Version=1.0.0.0, Culture=neutral, PublicKeyToken=11e6604a27f32a11
                    CreateWorkItem(web, "Hemrika.SharePresence.WebSite.Modules.WebPageModule.WebPageModule", "Hemrika.SharePresence.WebSite, Version=1.0.0.0, Culture=neutral, PublicKeyToken=11e6604a27f32a11");
                    //Hemrika.SharePresence.WebSite.Modules.LicenseModule.LicenseModule, Hemrika.SharePresence.WebSite, Version=1.0.0.0, Culture=neutral, PublicKeyToken=11e6604a27f32a11
                    CreateWorkItem(web, "Hemrika.SharePresence.WebSite.Modules.LicenseModule.LicenseModule", "Hemrika.SharePresence.WebSite, Version=1.0.0.0, Culture=neutral, PublicKeyToken=11e6604a27f32a11");
                    //Hemrika.SharePresence.WebSite.Modules.SemanticModule.SemanticModule, Hemrika.SharePresence.WebSite, Version=1.0.0.0, Culture=neutral, PublicKeyToken=11e6604a27f32a11
                    CreateWorkItem(web, "Hemrika.SharePresence.WebSite.Modules.SemanticModule.SemanticModule", "Hemrika.SharePresence.WebSite, Version=1.0.0.0, Culture=neutral, PublicKeyToken=11e6604a27f32a11");
                }
            }
            catch (Exception ex)
            {
                SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory(ex.Source, TraceSeverity.High, EventSeverity.Error), TraceSeverity.High, ex.Message, ex.Data);
                //ex.ToString();
            }

            /*
             * IConfigManager configManager = serviceLocator.GetInstance<IConfigManager>();
             * configManager.SetWeb(SPContext.Current.Site.RootWeb);
             * IPropertyBag bag = configManager.GetPropertyBag(ConfigLevel.CurrentSPSite);
             */

            try
            {
                SPUserCodeService userCodeService = SPUserCodeService.Local;

                AddProxyOperation(userCodeService, ContainsKeyDataArgs.OperationAssemblyName, ContainsKeyDataArgs.OperationTypeName);
                AddProxyOperation(userCodeService, ReadConfigArgs.OperationAssemblyName, ReadConfigArgs.OperationTypeName);
                AddProxyOperation(userCodeService, ProxyInstalledArgs.OperationAssemblyName, ProxyInstalledArgs.OperationTypeName);
                userCodeService.Update();
            }
            catch (Exception ex)
            {
                SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory(ex.Source, TraceSeverity.High, EventSeverity.Error), TraceSeverity.High, ex.Message, ex.Data);
                //ex.ToString();
            }
        }