Ejemplo n.º 1
0
        public DataStore()
        {
            IsSqlScriptsSet  = false;
            this.CommandType = CommandType.Text;
            NameValueCollection appSettings = ConfigurationManager.AppSettings;

            InitializeSqlScriptParamDict();
            string ssFile   = string.Empty;
            bool   finished = false;

            foreach (string appKey in appSettings.AllKeys)
            {
                foreach (string val in appSettings.GetValues(appKey))
                {
                    string appValue = appSettings[appKey];
                    string xmlFile  = appValue;
                    if (!string.IsNullOrEmpty(xmlFile) && appKey.StartsWith("SqlScriptsXml") && File.Exists(xmlFile))
                    {
                        ssFile   = xmlFile;
                        finished = true;
                        break;
                    }
                }
                if (finished)
                {
                    break;
                }
            }

            if (!string.IsNullOrEmpty(ssFile) && ssFile.Length > 0)
            {
                OperationResult op = new OperationResult();
                try
                {
                    this.SqlScripts = new SqlScripts();
                    SqlScripts.Load(ssFile, ref op);
                    IsSqlScriptsSet = op.Success ? true : false;
                }
                catch
                {
                    return;
                }
            }
        }
Ejemplo n.º 2
0
 public void LoadSqlScripts(string sqlScriptXml, ref OperationResult op)
 {
     this.SqlScripts = new SqlScripts();
     SqlScripts.Load(sqlScriptXml, ref op);
     IsSqlScriptsSet = op.Success ? true : false;
 }