Exemplo n.º 1
0
        public IDataMapHelper <T> GetProperties(DbDataReader dataReader)
        {
            Type type = this.Type;

            if (dataReader.IsClosed)
            {
                return(null);
            }

            iLen = dataReader.FieldCount;
            Ai.Guard.Check(iLen > 0, "DataMapper FieldCount error");

            map    = (int[])Array.CreateInstance(typeof(int), iLen);
            fields = SqlFieldArray.GetFields(dataReader);

            properties = type.GetProperties(
                BindingFlags.GetField | BindingFlags.Public | BindingFlags.Instance);

            for (int i = 0; i < properties.Length; i++)
            {
                for (int j = 0; j < iLen; j++)
                {
                    if (dataReader.GetName(j).Equals(properties[i].Name))
                    {
                        map[j] = i;
                    }
                }
            }
            return(this);
        }
Exemplo n.º 2
0
 public DbMapperXElem(DbDataReader dataReader)
     : base()
 {
     fields = SqlFieldArray.GetFields(dataReader);
 }