internal ObjectReader(Internals.Context context, ObjectQuery objectQuery, bool firstLevel) { this.context = context; this.firstLevel = firstLevel; this.objectType = objectQuery.ObjectType; this.pageIndex = objectQuery.PageIndex; this.hasEvents = context.Mappings[this.objectType.ToString()].HasEvents; Internals.Commands commands = context.Mappings.Commands(this.objectType.ToString()); if (objectQuery.PageSize > 0 && !objectQuery.SkipCounts) { string selectCount = commands.RecordCount(objectQuery.WhereClause); this.totalCount = int.Parse(context.Connection.GetScalarValue(this.objectType, CommandInfo.GetCount, selectCount).ToString()); double pages = (double)(1 + (this.totalCount - 1) / objectQuery.PageSize); this.pageCount = int.Parse(Math.Floor(pages).ToString()); } this.data = context.Connection.GetDataReader(this.objectType, CommandInfo.Select, commands.Select(objectQuery)); this.firstRead = true; if (this.data != null) { this.hasObjects = this.data.Read(); } if (!this.hasObjects) { this.Close(); } }
public DataSet GetDataSet(DataSet dataSet, ObjectQuery objectQuery, string[] selectFields) { Commands commands = this.mappings.Commands(objectQuery.ObjectType); return(this.connection.GetDataSet(objectQuery.ObjectType, CommandInfo.DataSet, dataSet, commands.Select(objectQuery, selectFields))); }