public static ActionResult CreateWebsite(Session session)
 {
     try
     {
         var webInstallationOptions = GetWebInstallationOptions(session);
         return(WebsiteCustomAction.DeployWebsite(session, webInstallationOptions));
     }
     catch (Exception ex)
     {
         session.ShowErrorMessage(ex);
         throw ex;
     }
 }
Exemple #2
0
        public static ActionResult CreateWebsite(Session session)
        {
            try
            {
                var allOptions = new Dictionary <string, WebInstallationOptions>();

                Dictionary <string, string> connectionStrings = new Dictionary <string, string>();
                connectionStrings["CprBroker.Config.Properties.Settings.CprBrokerConnectionString"] = DatabaseSetupInfo.CreateFromFeature(session, "CPR").CreateConnectionString(false, true);

                WebInstallationOptions cprOptions = new WebInstallationOptions()
                {
                    EncryptConnectionStrings            = true,
                    ConnectionStrings                   = new Dictionary <string, string>(connectionStrings),
                    InitializeFlatFileLogging           = true,
                    WebsiteDirectoryRelativePath        = EventBrokerCustomActions.PathConstants.CprBrokerWebsiteDirectoryRelativePath,
                    ConfigSectionGroupEncryptionOptions = new ConfigSectionGroupEncryptionOptions[]
                    {
                        new ConfigSectionGroupEncryptionOptions()
                        {
                            ConfigSectionGroupName         = Constants.DataProvidersSectionGroupName,
                            ConfigSectionEncryptionOptions = new ConfigSectionEncryptionOptions[]
                            {
                                new ConfigSectionEncryptionOptions()
                                {
                                    SectionName = DataProviderKeysSection.SectionName, SectionType = typeof(DataProviderKeysSection), CustomMethod = config => DataProviderKeysSection.RegisterInConfig(config)
                                },
                                new ConfigSectionEncryptionOptions()
                                {
                                    SectionName = DataProvidersConfigurationSection.SectionName, SectionType = typeof(DataProvidersConfigurationSection), CustomMethod = null
                                }
                            }
                        }
                    }
                };
                allOptions["CPR"] = cprOptions;

                connectionStrings["CprBroker.Config.Properties.Settings.EventBrokerConnectionString"] = DatabaseSetupInfo.CreateFromFeature(session, "EVENT").CreateConnectionString(false, true);
                WebInstallationOptions eventOptions = new WebInstallationOptions()
                {
                    EncryptConnectionStrings            = false,
                    ConnectionStrings                   = connectionStrings,
                    InitializeFlatFileLogging           = true,
                    WebsiteDirectoryRelativePath        = EventBrokerCustomActions.PathConstants.EventBrokerWebsiteDirectoryRelativePath,
                    ConfigSectionGroupEncryptionOptions = new ConfigSectionGroupEncryptionOptions[]
                    {
                        new ConfigSectionGroupEncryptionOptions()
                        {
                            ConfigSectionGroupName         = Constants.DataProvidersSectionGroupName,
                            ConfigSectionEncryptionOptions = new ConfigSectionEncryptionOptions[]
                            {
                                new ConfigSectionEncryptionOptions()
                                {
                                    SectionName = DataProviderKeysSection.SectionName, SectionType = typeof(DataProviderKeysSection), CustomMethod = config => DataProviderKeysSection.RegisterInConfig(config)
                                },
                                new ConfigSectionEncryptionOptions()
                                {
                                    SectionName = DataProvidersConfigurationSection.SectionName, SectionType = typeof(DataProvidersConfigurationSection), CustomMethod = null
                                }
                            }
                        }
                    }
                };
                allOptions["EVENT"] = eventOptions;

                return(WebsiteCustomAction.DeployWebsite(session, allOptions));
            }
            catch (Exception ex)
            {
                session.ShowErrorMessage(ex);
                throw ex;
            }
        }