示例#1
0
 private bool _IsTracedProperty(sTable tm, string fieldName, sTableField fld, string property)
 {
     sTable map = _pool.Mapping[_pool.Mapping[tm.GetRelationForProperty(property).Value.ExternalTable]];
     if (fieldName.Contains("."))
     {
         foreach (sTableField stf in map[fieldName.Substring(0, fieldName.IndexOf("."))])
         {
             if (stf.Name == fld.ExternalField)
                 return _IsTracedProperty(map, fieldName.Substring(fieldName.IndexOf(".") + 1), stf, fieldName.Substring(0, fieldName.IndexOf(".")));
         }
     }
     else
     {
         foreach (sTableField stf in map[fieldName])
         {
             if (stf.Name == fld.ExternalField)
                 return true;
         }
     }
     return false;
 }
示例#2
0
 private List<Type> _RecurLoadTypesForTable(sTable tbl, List<Type> types)
 {
     Type t = _pool.Mapping[tbl.Name];
     if (!t.BaseType.Equals(typeof(Org.Reddragonit.Dbpro.Structure.Table)) && _pool.Mapping.IsMappableType(t.BaseType))
         types = _RecurLoadTypesForTable(_pool.Mapping[t.BaseType], types);
     if (!types.Contains(t))
         types.Add(t);
     foreach (string prop in tbl.ForeignTableProperties)
     {
         sTableRelation rel = tbl.GetRelationForProperty(prop).Value;
         if (rel.ExternalTable != tbl.Name)
             types = _RecurLoadTypesForTable(_pool.Mapping[_pool.Mapping[rel.ExternalTable]], types);
     }
     foreach (string prop in tbl.Properties)
     {
         if (_pool.Mapping.PropertyHasIntermediateTable(t, prop))
         {
             sTable itbl = _pool.Mapping[t, prop];
             if (itbl.Relations!=null)
             {
                 if (itbl.Relations[1].ExternalTable != tbl.Name)
                     types = _RecurLoadTypesForTable(_pool.Mapping[_pool.Mapping[itbl.Relations[1].ExternalTable]], types);
             }
         }
     }
     foreach (Type tp in Utility.LocateAllTypesWithAttribute(typeof(ClassViewAttribute)))
     {
         if (!types.Contains(tp))
         {
             ClassViewAttribute cva = _pool[tp];
             foreach (Type tpe in cva.Query.RequiredTypes)
             {
                 if (types.Contains(tpe))
                 {
                     if (!types.Contains(tp))
                         types.Add(tp);
                     foreach (Type type in cva.Query.RequiredTypes)
                     {
                         if (!types.Contains(type))
                             types.Add(type);
                         types = _RecurLoadTypesForTable(_pool.Mapping[type], types);
                     }
                     break;
                 }
             }
         }
     }
     if (_pool is MsSqlConnectionPool)
         types = _RecurLoadChildrenForTypeForMSConnection(t,tbl, types);
     return types;
 }