コード例 #1
0
        public static AuditAutoDetectData[] AutoDetectDataAuditing(ConnectionData connData)
        {
            List <AuditAutoDetectData> lst = new List <AuditAutoDetectData>();

            string[]    auditTables = SqlSync.DbInformation.InfoHelper.GetDatabaseTableList(connData, String.Format(auditTableNameFormat, "%"));
            TableSize[] allTable    = SqlSync.DbInformation.InfoHelper.GetDatabaseTableListWithRowCount(connData);
            string      baseName;
            int         rowCount;

            for (int i = 0; i < auditTables.Length; i++)
            {
                baseName = auditTables[i].Replace(String.Format(auditTableNameFormat, ""), "");

                rowCount = SqlSync.DbInformation.InfoHelper.DbContainsTableWithRowcount(baseName, allTable);
                if (rowCount > -1)
                {
                    AuditAutoDetectData dat = new AuditAutoDetectData();
                    dat.TableName     = baseName;
                    dat.RowCount      = rowCount;
                    dat.HasAuditTable = true;
                    lst.Add(dat);
                }
            }
            string[] allTriggers = SqlSync.DbInformation.InfoHelper.GetTriggers(connData);
            for (int i = 0; i < lst.Count; i++)
            {
                IAuditInfo item = lst[i];
                CheckForStandardAuditTriggers(ref item, allTriggers);
            }

            AuditAutoDetectData[] data = new AuditAutoDetectData[lst.Count];
            lst.CopyTo(data);
            return(data);
        }
コード例 #2
0
 /// <summary>
 ///Populates the data class using matching data class object as a source. Simulates a "deep copy" action
 ///</summary>
 /// <param name="dataClass">A populated data class that you want to copy the data from</param>
 public virtual bool Fill(AuditAutoDetectData dataClass)
 {
     try {
         this.TableName             = dataClass.TableName;
         this.RowCount              = dataClass.RowCount;
         this.HasAuditTable         = dataClass.HasAuditTable;
         this.HasAuditUpdateTrigger = dataClass.HasAuditUpdateTrigger;
         this.HasAuditInsertTrigger = dataClass.HasAuditInsertTrigger;
         this.HasAuditDeleteTrigger = dataClass.HasAuditDeleteTrigger;
         this.fillCount             = fillCount + 1;
         return(true);
     }
     catch (System.Exception ex) {
         throw new AuditAutoDetectDataException("Error in the Auto-Generated: AuditAutoDetectData.Fill(AuditAutoDetectData) Method", ex);
     }
 }