예제 #1
0
파일: DB.cs 프로젝트: wra222/testgit
 private void RegistInner(string key1, string key2, TableConnectionItem item)
 {
     IDictionary<string, TableConnectionItem> nowPoint = null;
     if (regist.ContainsKey(key1))
     {
         nowPoint = regist[key1];
     }
     else
     {
         nowPoint = new Dictionary<string, TableConnectionItem>();
         regist.Add(key1, nowPoint);
     }
     if (!nowPoint.ContainsKey(key2))
     {
         nowPoint.Add(key2, item);
     }
 }
예제 #2
0
파일: DB.cs 프로젝트: wra222/testgit
 public void Add(TableConnectionItem joinCondtion)
 {
     _queue.Enqueue(joinCondtion);
 }
예제 #3
0
파일: DB.cs 프로젝트: wra222/testgit
        ////Do not recommed.
        //private TableConnectionCollection(TableConnection[] values)
        //{
        //    if (values != null && values.Length > 0)
        //    {
        //        foreach (TableConnection item in values)
        //        {
        //            if (item.Table1 != null && item.Table2 != null && item.FieldNamesFromTable1 != null && item.FieldNamesFromTable2 != null && item.FieldNamesFromTable2.Length == item.FieldNamesFromTable1.Length)
        //            {
        //                for (int i = 0; i < item.FieldNamesFromTable1.Length; i++ )
        //                {
        //                    TableConnectionItem entry = new TableConnectionItem(item.Table1, item.FieldNamesFromTable1[i], item.Table2, item.FieldNamesFromTable2[i]);
        //                    if(!content.Contains(entry))
        //                        content.Add(entry);

        //                    string key1 = Func.DecAlias(entry.Table1.Name, entry.FieldNameFromTable1);
        //                    string key2 = Func.DecAlias(entry.Table2.Name, entry.FieldNameFromTable2);
        //                    RegistInner(key1, key2, entry);
        //                    RegistInner(key2, key1, entry);
        //                }
        //            }
        //        }
        //    }
        //}

        //Recommed.
        public TableConnectionCollection(TableConnectionItem[] values)
        {
            if (values != null && values.Length > 0)
            {
                foreach (TableConnectionItem item in values)
                {
                    if (!content.Contains(item))
                        content.Add(item);

                    //string key1 = Func.DecAlias(item.Table1.Name, item.FieldNameFromTable1);
                    //string key2 = Func.DecAlias(item.Table2.Name, item.FieldNameFromTable2);
                    string key1 = Func.DecAlias(item.Tb1.GetHashCode().ToString(), item.FieldNameFromTable1);
                    string key2 = Func.DecAlias(item.Tb2.GetHashCode().ToString(), item.FieldNameFromTable2);

                    RegistInner(key1, key2, item);
                    RegistInner(key2, key1, item);
                }
            }
        }