Exemple #1
0
        private void Init(string name, DatasetClient parent)
        {
            subitems = new List <SubItemEntry>();

            // iterate over public fields
            FieldInfo[] fields = typeof(T).GetFields(BindingFlags.Public | BindingFlags.Instance);
            foreach (FieldInfo fi in fields)
            {
                if (CanMapType(fi.FieldType))
                {
                    // want to map this stuff
                    SubItemEntry entry = new SubItemEntry(BuildFieldGetter(typeof(T), fi), GetDataItemClient(fi.FieldType, name + "." + fi.Name));
                    subitems.Add(entry);
                    parent.Add(entry.subitem.Name, entry.subitem);
                }
            }

            PropertyInfo[] props = typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance);
            foreach (PropertyInfo prop in props)
            {
                if (CanMapType(prop.PropertyType))
                {
                    // want to map this stuff
                    SubItemEntry entry = new SubItemEntry(BuildPropertyGetter(typeof(T), prop), GetDataItemClient(prop.PropertyType, name + "." + prop.Name));
                    subitems.Add(entry);
                    parent.Add(entry.subitem.Name, entry.subitem);
                }
            }
        }
Exemple #2
0
 public MapFieldsDataItemClient(string name, DatasetClient parent)
     : base(name)
 {
     Init(name, parent);
 }
Exemple #3
0
 public MapFieldsDataItemClient(DataItemDescriptor desc, DatasetClient parent)
     : base(desc)
 {
     Init(desc.Name, parent);
 }