Exemple #1
0
        /// <summary>
        /// 根据读取的rule字符构建成一个Rule对象
        /// </summary>
        /// <param name="theRuleName">rule的名字</param>
        /// <param name="theRuleStrings">rule的字符串</param>
        private static TransferRule CalculateRules(string theRuleName, string theRuleStrings)
        {
            TransferRule tr = new TransferRule();

            tr.RuleName = theRuleName;

            Regex           rules           = new Regex(@"(?<DbName>\w+):(\[(?<TableName>\w+)\(?(?<FilterRule>\w*)\)?\])+");
            MatchCollection matchCollection = rules.Matches(theRuleStrings);

            foreach (Match aMatch in matchCollection)
            {
                //确定数据库
                Utility.AssertAreSame(1, aMatch.Groups["DbName"].Captures.Count, DbErrorString(theRuleName));
                DbTransfer dt = new DbTransfer();
                dt.DbName = aMatch.Groups["DbName"].Captures[0].Value;
                //确定表
                Utility.AssertAreSame(aMatch.Groups["TableName"].Captures.Count, aMatch.Groups["FilterRule"].Captures.Count, TableErrorString(theRuleName));
                for (int i = 0; i < aMatch.Groups["TableName"].Captures.Count; i++)
                {
                    TableTransfer tt = new TableTransfer();
                    tt.TableName       = aMatch.Groups["TableName"].Captures[i].Value;
                    tt.TableFilterName = aMatch.Groups["FilterRule"].Captures[i].Value;
                    dt.AddTransferTable(tt);
                }
                tr.DbsToTransfer.Add(dt);
            }
            return(tr);
        }
 public object Clone()
 {
     TableTransfer aCloneObj = new TableTransfer();
     aCloneObj._TableFilter = _TableFilter.Clone() as ITableFilter;
     aCloneObj._TableFilterName = _TableFilterName;
     aCloneObj._TableName = _TableName;
     return aCloneObj;
 }
Exemple #3
0
 /// <summary>
 /// 添加TransferTable
 /// </summary>
 public void AddTransferTable(TableTransfer tableTransfer)
 {
     if (FindTableTransfer(tableTransfer.TableName) == null && FindTableProtected(tableTransfer.TableName) == null)
     {
         _TablesToTransfer.Add(tableTransfer);
     }
     else
     {
         throw new ApplicationException(string.Format("{0}{1}、{2}", Utility._Error_DefineTransfer_Exist_Table, _DbName, tableTransfer.TableName));
     }
 }