Esempio n. 1
0
 public sTable(string name, sTableField[] fields, List<PropertyInfo> arrayProperties, sTableRelation[] relations, string[] primaryKeyFields, string autoGenField)
 {
     _name = name;
     _fields = fields;
     _relations = relations;
     _primaryKeyFields = primaryKeyFields;
     _autoGenField = autoGenField;
     _arrayProperties = new List<string>(new string[(arrayProperties == null ? 0 : arrayProperties.Count)]);
     for (int x = 0; x < _arrayProperties.Count; x++)
     {
         _arrayProperties[x] = arrayProperties[x].Name;
     }
 }
Esempio n. 2
0
 internal static object LocateFieldValue(Table table,sTableField fld,ConnectionPool pool)
 {
     if (fld.ExternalField == null || fld.Type == FieldType.ENUM)
     {
         object obj = table.GetField(fld.ClassProperty);
         if (obj == null)
             return null;
         else if (obj is Table)
         {
             foreach (sTableField field in pool.Mapping[obj.GetType()].Fields)
             {
                 if (field.Name == fld.ExternalField)
                 {
                     return LocateFieldValue((Table)obj, field, pool);
                 }
             }
         }
         else
             return obj;
     }
     else
     {
         Table val = (Table)table.GetField(fld.ClassProperty);
         if (val == null)
             return null;
         else
         {
             foreach (sTableField field in pool.Mapping[val.GetType()].Fields)
             {
                 if (field.Name == fld.ExternalField)
                 {
                     return LocateFieldValue(val, field, pool);
                 }
             }
         }
     }
     return null;
 }
Esempio n. 3
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;
 }