Exemplo n.º 1
0
 public void Dispose()
 {
     _src.DisposeReader(_r);
     _src   = null;
     _r     = null;
     _table = null;
 }
Exemplo n.º 2
0
 public ReflectedTable <T> Get <T>() where T : class, new()
 {
     lock (this) {
         var table = GetLineTableName(typeof(T));
         if (tables.ContainsKey(table))
         {
             return((ReflectedTable <T>)tables[table]);
         }
         var result = new ReflectedTable <T>(src);
         tables.Add(table, result);
         return(result);
     }
 }
Exemplo n.º 3
0
        internal static T readerToLine <T>(List <FieldInfo> fields, IDataReader r) where T : class, new()
        {
            var line = new T();

            for (var i = 0; i < fields.Count; i++)
            {
                var columnValue = ReflectedTable <T> .ReadColumn(r, i, fields[i].FieldType);

                if (columnValue == null && !ReflectedTable <T> .IsNullableType(fields[i].FieldType))
                {
                    continue;
                }
                fields[i].SetValue(line, columnValue);
            }

            return(line);
        }
        public IEnumerable <T> Like(string indexValuePattern)
        {
            if (_typeIsAttributed)
            {
                var tmpTable = new ReflectedTable <T>(Src);
                return(Query(tmpTable.GetLikeCriteria(indexValuePattern)));
            }

            string likeField = null;

            for (var i = 0; i < _fieldsList.Count; i++)
            {
                if (_fieldsList[i].FieldType == typeof(string))
                {
                    likeField = _fieldsNames[i];
                    break;
                }
            }

            return(Query(ReflectedTable <T> .GetLikeStatement(likeField, indexValuePattern)));
        }
Exemplo n.º 5
0
 internal QueryTableEnumerable(ReflectedTable <T> table, string sql)
 {
     this._table = table;
     this._sql   = sql;
 }
Exemplo n.º 6
0
 internal DataTableReaderEnumerator(DataSource src, ReflectedTable <T> table, IDataReader r)
 {
     this._src   = src;
     this._r     = r;
     this._table = table;
 }
 internal QueryTableSet(string sectionWhere, string sectionOrderBy, ReflectedTable <T> table)
 {
     this._sectionWhere   = sectionWhere;
     this._sectionOrderBy = sectionOrderBy;
     Table = table;
 }