public static ActionResult DeployDatabase(Session session) { try { // Prepare SQL scripts var createDatabaseObjectsSql = new Dictionary <string, string>(); createDatabaseObjectsSql["CPR"] = Properties.Resources.CreatePartDatabaseObjects; createDatabaseObjectsSql["EVENT"] = CprBroker.Installers.EventBrokerInstallers.Properties.Resources.CreateEventBrokerDatabaseObjects; // Prepare lookups var lookupDataArray = new Dictionary <string, KeyValuePair <string, string>[]>(); List <KeyValuePair <string, string> > cprLookups = new List <KeyValuePair <string, string> >(); cprLookups.Add(new KeyValuePair <string, string>(typeof(CprBroker.Data.Applications.Application).Name, Properties.Resources.Application)); cprLookups.Add(new KeyValuePair <string, string>(typeof(LifecycleStatus).Name, Properties.Resources.LifecycleStatus)); cprLookups.Add(new KeyValuePair <string, string>(typeof(LogType).Name, Properties.Resources.LogType)); cprLookups.Add(new KeyValuePair <string, string>(typeof(CprBroker.Data.DataProviders.BudgetInterval).Name, Properties.Resources.BudgetEntry)); lookupDataArray["CPR"] = cprLookups.ToArray(); List <KeyValuePair <string, string> > eventLookups = new List <KeyValuePair <string, string> >(); eventLookups.Add(new KeyValuePair <string, string>(typeof(ChannelType).Name, CprBroker.Installers.EventBrokerInstallers.Properties.Resources.ChannelType)); eventLookups.Add(new KeyValuePair <string, string>(typeof(SubscriptionType).Name, CprBroker.Installers.EventBrokerInstallers.Properties.Resources.SubscriptionType)); lookupDataArray["EVENT"] = eventLookups.ToArray(); // Custom methods var customMethods = new Dictionary <string, Action <SqlConnection> >(); customMethods["CPR"] = conn => CprBroker.Providers.CPRDirect.Authority.ImportText(Properties.Resources.Authority_4357, conn); return(DatabaseCustomAction.DeployDatabase(session, createDatabaseObjectsSql, lookupDataArray, customMethods)); } catch (Exception ex) { session.ShowErrorMessage(ex); throw ex; } }
public static ActionResult DeployDatabase(Session session) { try { DatabaseSetupInfo databaseSetupInfo = DatabaseSetupInfo.CreateFromFeature(session, "PM"); string sql = Properties.Resources.crebas; sql = sql.Replace("<pm-cryptpassword>", databaseSetupInfo.EncryptionKey); sql = sql.Replace("<pm-namespace>", databaseSetupInfo.Domain); var sqlDictionary = new Dictionary <string, string>(); sqlDictionary["PM"] = sql; var lookupDictinary = new Dictionary <string, KeyValuePair <string, string>[]>(); lookupDictinary["PM"] = new KeyValuePair <string, string> [0]; return(DatabaseCustomAction.DeployDatabase(session, sqlDictionary, lookupDictinary)); } catch (Exception ex) { session.ShowErrorMessage(ex); throw ex; } }