Ejemplo n.º 1
0
        public void select(IEnumerable list, object obj, string query)
        {
            dbPropertyInfoManager mgr = dbPropertyInfoManager.Instance;

            IDataReader r = select(query);

            while (r.Read())
            {
                object newObject = Activator.CreateInstance(obj.GetType());
                mgr.setObject(newObject);

                for (int i = 0; i < r.FieldCount; i++)
                {
                    mgr.setValue(r.GetName(i), r.GetValue(i));
                }
                IList ilist = (IList)list;
                ilist.Add(newObject);
            }
        }
Ejemplo n.º 2
0
        public void select(object obj)
        {
            dbPropertyInfoManager mgr = dbPropertyInfoManager.Instance;

            mgr.setObject(obj);
            foreach (dbPropertyInfo p in mgr)
            {
                if (p.isKey)
                {
                    addCondition(p.fieldName, p.getValue());
                }
            }
            using (IDataReader r = select(getSelect(obj)))
            {
                if (r.Read())
                {
                    for (int i = 0; i < r.FieldCount; i++)
                    {
                        mgr.setValue(r.GetName(i), r.GetValue(i));
                    }
                }
                r.Close();
            }
        }