コード例 #1
0
ファイル: ScriptEngine.cs プロジェクト: nhcloud/SqlEtl
 internal Dictionary<string, object> GetScript()
 {
     var provisioningTSql = new Dictionary<string, object>();
     var logic = new Dictionary<string, string>();
     var removeExisting = new StringBuilder();
     removeExisting.Append(SqlTemplate.Get("DisableConstraintCheck"));
     removeExisting.Append(SqlTemplate.Get("DisableAllTrigger"));
     foreach (var ti in _scopeDescription)
     {
         var script = new ScriptLogic(ti);
         logic.Add(ti.Name, script.SelectChanges);
     }
     for (var i = _scopeDescription.Count - 1; i >= 0; i--)
         removeExisting.Append("delete from  " + _scopeDescription[i].Name + ";");
     removeExisting.Append(SqlTemplate.Get("EnableAllTrigger"));
     removeExisting.Append(SqlTemplate.Get("EnableConstraintCheck"));
     provisioningTSql.Add("Logic", logic);
     provisioningTSql.Add("Truncate", removeExisting.ToString());
     return provisioningTSql;
 }
コード例 #2
0
ファイル: ScriptEngine.cs プロジェクト: curious95/SqlEtl
        internal Dictionary <string, object> GetScript()
        {
            var provisioningTSql = new Dictionary <string, object>();
            var logic            = new Dictionary <string, string>();
            var removeExisting   = new StringBuilder();

            removeExisting.Append(SqlTemplate.Get("DisableConstraintCheck"));
            removeExisting.Append(SqlTemplate.Get("DisableAllTrigger"));
            foreach (var ti in _scopeDescription)
            {
                var script = new ScriptLogic(ti);
                logic.Add(ti.Name, script.SelectChanges);
            }
            for (var i = _scopeDescription.Count - 1; i >= 0; i--)
            {
                removeExisting.Append("delete from  " + _scopeDescription[i].Name + ";");
            }
            removeExisting.Append(SqlTemplate.Get("EnableAllTrigger"));
            removeExisting.Append(SqlTemplate.Get("EnableConstraintCheck"));
            provisioningTSql.Add("Logic", logic);
            provisioningTSql.Add("Truncate", removeExisting.ToString());
            return(provisioningTSql);
        }