예제 #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);
        }
예제 #2
0
        private bool ExecProc(ISqlProc proc, int iFrom = 0, int iTake = 0)
        {
            Ai.Guard.Check(proc.CmdText.Length > 0, "SqlTable proc error");
            Ai.Guard.Check(Fields != null, "SqlTable Fields error");

            var fld = this.Fields;

            Action <SqlTableMapper, DbDataReader> parser = (map, dbReader) =>
            {
                fld         = SqlFieldArray.GetArray(dbReader);
                this.Fields = fld;
            };

            bool init = this.queryParam.Prepare(proc, parser, this.Timeout);

            Guard.Check(fld.Length > 0, "fld.Length error");

            return(init);
        }
예제 #3
0
 public DbMapperXElem(DbDataReader dataReader)
     : base()
 {
     fields = SqlFieldArray.GetFields(dataReader);
 }
예제 #4
0
 public virtual SqlField[] GetFields(DbDataReader dataReader)
 {
     return(SqlFieldArray.GetArray(dataReader));
 }