// Jeff Lanning ([email protected]): Added for OPath support. internal ObjectReader(Internals.Context context, CompiledQuery query, bool firstLevel, object[] parameters) { this.context = context; this.firstLevel = firstLevel; this.objectType = query.ObjectType; this.pageIndex = 1; this.hasEvents = context.Mappings[this.objectType].HasEvents; this.data = context.Connection.GetDataReader(this.objectType, CommandInfo.Select, query, parameters); this.firstRead = true; if (this.data != null) this.hasObjects = this.data.Read(); if (!this.hasObjects) this.Close(); }
/// <summary> /// Executes this query against an ObjectSpace data store and returns an array filled with the results. /// </summary> /// <param name="os">ObjectSpace instance to use.</param> /// <param name="parameters">Parameter values to use when executing the query.</param> /// <returns>An array filled with objects retrieved from the data store.</returns> public List <T> GetList(ObjectSpace os, params object[] parameters) { CompiledQuery <T> cq = this.Compile(os); List <T> list = new List <T>(32); using (ObjectReader reader = os.GetObjectReader(cq, parameters)) { while (reader.Read()) { list.Add((T)reader.Current()); } } return(list); }
// Jeff Lanning ([email protected]): Added for OPath support. internal ObjectReader(Internals.Context context, CompiledQuery query, bool firstLevel, object[] parameters) { this.context = context; this.firstLevel = firstLevel; this.objectType = query.ObjectType; this.pageIndex = 1; this.hasEvents = context.Mappings[this.objectType].HasEvents; this.data = context.Connection.GetDataReader(this.objectType, CommandInfo.Select, query, parameters); this.firstRead = true; if (this.data != null) { this.hasObjects = this.data.Read(); } if (!this.hasObjects) { this.Close(); } }
/// <summary> /// Executes this OPathQuery against an ObjectSpace data store and returns an ObjectSet filled with the results. /// </summary> /// <param name="os">ObjectSpace instance to use.</param> /// <param name="parameters">Parameter values to use when executing the query.</param> /// <returns>An ObjectSet filled with objects retrieved from the data store.</returns> public ObjectSet <T> GetObjectSet(ObjectSpace os, params object[] parameters) { CompiledQuery <T> cq = this.Compile(os); return(os.GetObjectSet <T>(cq, parameters)); }
// Jeff Lanning ([email protected]): Added for OPath support. internal ObjectReader(Internals.Context context, CompiledQuery <T> query, bool firstLevel, object[] parameters) : base(context, query, firstLevel, parameters) { }