ExecuteNonQuery() public méthode

public ExecuteNonQuery ( string sql, int timeout = 30, object>.IDictionary parameters = null ) : void
sql string
timeout int
parameters object>.IDictionary
Résultat void
Exemple #1
0
        public void ApplyReleases(string releasesPath, string databaseName)
        {
            if (!Directory.Exists(releasesPath))
            {
                return;
            }

            var scriptsDirectoryInfo = new DirectoryInfo(releasesPath);
            var scriptFiles          = scriptsDirectoryInfo.GetFiles("*.sql", SearchOption.TopDirectoryOnly);

            var applicableScriptFiles = from f in scriptFiles
                                        let number = _schemaVersionInformation.ReleaseNumberOfFile(f)
                                                     orderby number
                                                     select new { file = f, number };

            foreach (var scriptFile in applicableScriptFiles)
            {
                // What to catch and throw here?!

                var sql = File.ReadAllText(scriptFile.file.FullName);
                sql = ReplaceScriptTags(sql, databaseName);
                _executeSql.ExecuteNonQuery(sql, 10800);
                //try
                //	{

                //	}
                //	catch (SqlException exception)
                //	{
                //throw new NotExecutableScriptException(scriptFile.file.FullName, "scriptFile", exception);
                //	}
            }
        }