public SqlScript(ScriptContentResource resource, DatabaseConnection connection)
     : base(resource, connection)
 {
 }
Example #2
0
 protected Script(ScriptContentResource resource, DatabaseConnection connection)
 {
     InitializeScript(resource, connection);
 }
        private void LoadScriptPackage_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            OpenFileDialog packageLoad = new OpenFileDialog();
            packageLoad.Filter = SCRIPT_PACKAGE_FILTER;
            packageLoad.CheckFileExists = true;

            if (packageLoad.ShowDialog() != true)
                return;

            ScriptPackage package = new ScriptPackage();
            package.Load(packageLoad.FileName);

            this.Scripts.Clear();
            foreach (Script script in package.Scripts)
            {
                DatabaseConnection matchingConnection = (from connection in DatabaseConnections
                                                         where connection.ConnectionString == script.Connection.ConnectionString
                                                         select connection).FirstOrDefault();

                if (matchingConnection == null)
                {
                    matchingConnection = new DatabaseConnection("[PACKAGE] " + script.Connection.ConnectionName, script.Connection.ConnectionString);
                    this.DatabaseConnections.Add(matchingConnection);
                }

                script.Connection = matchingConnection;
                this.Scripts.Add(new ScriptWrapper(script));
            }
        }
Example #4
0
 public virtual void InitializeScript(ScriptContentResource resource, DatabaseConnection connection)
 {
     this.ContentResource = resource;
     this.Connection = connection;
 }