private IQueryable <IEntity> Query( Type type, DbDataReader r, int pageSize, int pageIndex) { using (var il = new ILogger()) { var list = new List <IEntity>(); using (var reader = new SqlReader(r)) { IEntity schema = EntityCache.Get(type.Name); // dynamic var dc = schema.__EnableDynamic ? r.GetColumns() : null; while (reader.Read()) { IEntity one = Reflector .CreateInstance(type) as IEntity; reader.Bind(il, one); list.Add(one); // dynamic if (null != dc) { var row = one as DynamicRow; r.CurrentBindDynamicRow(dc, ref row); } } } // AfterSelect foreach (var instance in list) { var one = instance as Entity; if (null != one) { one.InvokeAfterSelect(); } } return(list.AsQueryable()); } }
public override void DoAfterStop() { EntityCache.Clear(); }