internal void buildFieldList(DatabaseImpl db, System.Type cls, ArrayList list)
{
System.Type superclass = cls.BaseType;
if (superclass != null && superclass != typeof(MarshalByRefObject))
{
buildFieldList(db, superclass, list);
}
System.Reflection.FieldInfo[] flds = cls.GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.DeclaredOnly);
bool isWrapper = typeof(PersistentWrapper).IsAssignableFrom(cls);
bool hasTransparentAttribute = cls.GetCustomAttributes(typeof(TransparentPersistenceAttribute), true).Length != 0;
for (int i = 0; i < flds.Length; i++)
{
FieldInfo f = flds[i];
if (!f.IsNotSerialized && !f.IsStatic)
{
FieldDescriptor fd = new FieldDescriptor();
fd.field = f;
fd.fieldName = f.Name;
fd.className = getTypeName(cls);
Type fieldType = f.FieldType;
FieldType type = getTypeCode(fieldType);
switch (type)
{
case FieldType.tpInt:
if (isWrapper && isObjectProperty(cls, f))
{
hasReferences = true;
type = FieldType.tpOid;
}
break;
case FieldType.tpArrayOfOid:
fd.constructor = GetConstructor(f, "ConstructArray");
hasReferences = true;
break;
case FieldType.tpLink:
fd.constructor = GetConstructor(f, "ConstructLink");
hasReferences = true;
break;
case FieldType.tpArrayOfObject:
case FieldType.tpObject:
hasReferences = true;
if (hasTransparentAttribute && isVolanteInternalType(fieldType))
{
fd.recursiveLoading = true;
}
break;
case FieldType.tpValue:
fd.valueDesc = db.getClassDescriptor(f.FieldType);
hasReferences |= fd.valueDesc.hasReferences;
break;
case FieldType.tpArrayOfValue:
fd.valueDesc = db.getClassDescriptor(f.FieldType.GetElementType());
hasReferences |= fd.valueDesc.hasReferences;
break;
}
fd.type = type;
list.Add(fd);
}
}
}