public void LoadCommand(String connectionString, String outputDirectoryPath, String namespaceName, String databaseKey)
        {
            this.Commands.Clear();

            var sv = this;
            var sc = _SchemaData;

            sc.NamespaceName = namespaceName;
            sc.DatabaseKey   = databaseKey;

            DatabaseSchemaReader db = DatabaseSchemaReader.Create(sc.DatabaseServer, connectionString);

            var tt = db.GetTables();
            var ss = db.GetStoredProcedures();
            var uu = db.GetUserDefinedTableTypes();

            {
                var cm = new ImportTableCommand(sc, connectionString);
                cm.Names.AddRange(tt.Where(el => this.ImportAllObject == true || el.LastAlteredTime > sc.LastExecuteTimeOfImportTable).Select(el => el.Name));
                cm.Names.RemoveAll(name => sc.IgnoreObjects.Exists(el => el.Name == name));
                sv.Commands.Add(cm);
            }
            {
                var cm = new ImportStoredProcedureCommand(sc, connectionString);
                cm.Names.AddRange(ss.Where(el => this.ImportAllObject == true || el.LastAlteredTime > sc.LastExecuteTimeOfImportStoredProcedure).Select(el => el.Name));
                cm.Names.RemoveAll(name => sc.IgnoreObjects.Exists(el => el.Name == name));
                sv.Commands.Add(cm);
            }
            {
                var cm = new ImportUserDefinedTableTypeCommand(sc, connectionString);
                cm.Names.AddRange(uu.Where(el => this.ImportAllObject == true || el.LastAlteredTime > sc.LastExecuteTimeOfImportUserDefinedTableType).Select(el => el.Name));
                cm.Names.RemoveAll(name => sc.IgnoreObjects.Exists(el => el.Name == name));
                sv.Commands.Add(cm);
            }

            {
                var cm = new DeleteObjectCommand(outputDirectoryPath, sc, connectionString);
                cm.Started += (o, ea) =>
                {
                    var tNames = db.GetTables().Select(el => el.Name).ToList();
                    var sNames = db.GetStoredProcedures().Select(el => el.Name).ToList();
                    var uNames = db.GetUserDefinedTableTypes().Select(el => el.Name).ToList();
                    cm.TableNames.AddRange(sc.Tables.Where(el => tNames.Contains(el.Name) == false).Select(el => el.Name));
                    cm.StoredProcedures.AddRange(sc.StoredProcedures.Where(el => sNames.Contains(el.Name) == false).Select(el => el.Name));
                    cm.UserDefinedTableTypes.AddRange(sc.UserDefinedTableTypes.Where(el => uNames.Contains(el.Name) == false).Select(el => el.Name));
                };
                sv.Commands.Add(cm);
            }

            {
                var cm = new GenerateSourceCodeCommand(outputDirectoryPath, sc);
                cm.Started += (o, ea) =>
                {
                    cm.Tables.AddRange(sc.Tables);
                    cm.StoredProcedures.AddRange(sc.StoredProcedures);
                    cm.UserDefinedTableTypes.AddRange(sc.UserDefinedTableTypes);
                };
                sv.Commands.Add(cm);
            }
        }
        private void ImportStoredProcedure(String connectionString, Int32 offsetHour)
        {
            var l = new List <DatabaseObject>();
            DatabaseSchemaReader db = DatabaseSchemaReader.Create(AValue.SchemaData.DatabaseServer, connectionString);

            foreach (var item in db.GetStoredProcedures())
            {
                if (this.ImportAllCheckBox.IsChecked == false &&
                    item.LastAlteredTime + TimeSpan.FromHours(offsetHour) < AValue.SchemaData.LastExecuteTimeOfImportStoredProcedure)
                {
                    continue;
                }
                if (AValue.SchemaData.IgnoreObjects.Exists(el => el.Name == item.Name) == true)
                {
                    continue;
                }

                l.Add(item);
            }

            _StoredProcedures.Clear();
            foreach (var item in l.Select(el => CheckedItem.Create(el)))
            {
                item.IsChecked = true;
                _StoredProcedures.Add(item);
            }
            this.StoredProcedureSelectAllCheckBox.IsChecked = true;
        }
        private void ImportStoredProcedure()
        {
            DatabaseSchemaReader db = DatabaseSchemaReader.Create(AValue.SchemaData.DatabaseServer, this.GetSelectedConnectionString());
            var l = db.GetStoredProcedures().ToList();

            _StoredProcedures.Clear();
            foreach (var item in AValue.SchemaData.StoredProcedures.Where(el => l.Exists(sp => sp.Name == el.Name) == false).Select(el => CheckedItem.Create(el)))
            {
                _StoredProcedures.Add(item);
            }
            this.StoredProcedureSelectAllCheckBox.IsChecked = true;
        }