コード例 #1
0
 public virtual T GetByID(ISessionWrapper session, S id)
 {
     lock (globalDBLock)
     {
         return(session.Get <T>(id));
     }
 }
コード例 #2
0
        public static void ExecuteDumpPropertiesToCustomActiondata(ISessionWrapper session)
        {
            string transientProperties = getTransientProperties(session);

            string[] parts = transientProperties.Split(';');
            var      sb    = new StringBuilder();

            foreach (string key in parts)
            {
                if (String.IsNullOrEmpty(key))
                {
                    continue;
                }

                string value = session.Get(key);
                if (!string.IsNullOrEmpty(value))
                {
                    value = Convert.ToBase64String(Encoding.UTF8.GetBytes(value));
                }

                sb.AppendFormat("{0}={1};", key, value);
            }

            session.Set("CUSTOM_ACTION_DATA", sb.ToString());
        }
コード例 #3
0
        private static string getTransientProperties(ISessionWrapper session)
        {
            int    index = 0;
            string key   = String.Format("TransientProperties{0}", index);
            string value = String.Empty;
            bool   end   = false;

            do
            {
                string currentValue = session.Get(key);
                if (!String.IsNullOrEmpty(currentValue))
                {
                    if (!value.EndsWith(";"))
                    {
                        value = value + ";";
                    }

                    value += currentValue;
                    index++;
                    key = String.Format("TransientProperties{0}", index);
                }
                else
                {
                    end = true;
                }
            } while (!end);

            return(value.Substring(1));
        }
コード例 #4
0
        public static void ExecuteModifyConfigurationFile(ISessionWrapper session)
        {
            //System.Diagnostics.Debugger.Launch();

            string customerName         = session.Get(CUSTOMER_NAME[0]);
            string groupName            = session.Get(GROUP_NAME[0]);
            string configFileUrl        = session.Get(CONFIG_FILE_URL[0]);
            string monitorWebServiceUrl = session.Get(MONITOR_WEBSERVICE_URL[0]);
            string monitorHost          = session.Get(MONITOR_HOST[0]);
            string connectionString     = session.Get(CONNECTION_STRING[0]);
            string installLocation      = session.Get("INSTALL_LOCATION");

            session.Log("CUSTOMER_NAME = " + customerName);
            session.Log("GROUP_NAME = " + groupName);
            session.Log("CONFIG_FILE_URL = " + configFileUrl);
            session.Log("MONITOR_WEBSERVICE_URL = " + monitorWebServiceUrl);
            session.Log("MONITOR_HOST = " + monitorHost);
            session.Log("CONNECTION_STRING = " + connectionString);
            session.Log("INSTALL_LOCATION" + installLocation);

            string configFilePath = Path.Combine(installLocation, "Cegeka.Updater.Service.exe.config");

            var doc         = XDocument.Load(configFilePath);
            var appSettings = doc.Descendants().FirstOrDefault(e => e.Name == "appSettings");

            replaceAppSettingAttributeValue(appSettings, CUSTOMER_NAME[1], customerName);
            replaceAppSettingAttributeValue(appSettings, GROUP_NAME[1], groupName);
            replaceAppSettingAttributeValue(appSettings, CONFIG_FILE_URL[1], configFileUrl);
            replaceAppSettingAttributeValue(appSettings, MONITOR_WEBSERVICE_URL[1], monitorWebServiceUrl);
            replaceAppSettingAttributeValue(appSettings, MONITOR_HOST[1], monitorHost);

            var connectionStringSection = doc.Descendants().FirstOrDefault(e => e.Name == "connectionStrings");

            replaceConnectionString(connectionStringSection, CONNECTION_STRING[1], connectionString);

            doc.Save(configFilePath);
        }
コード例 #5
0
 public virtual T GetByID(ISessionWrapper session, S id)
 {
     return(session.Get <T>(id));
 }