/// <summary> /// /// </summary> /// <param name="ctx"></param> /// <param name="tag"></param> /// <param name="parameterObject"></param> /// <returns></returns> public override int DoStartFragment(SqlTagContext ctx, SqlTag tag, object parameterObject) { IterateContext iterate = (IterateContext)ctx.GetAttribute(tag); if (iterate == null) { string propertyName = ((BaseTag)tag).Property; object collection; if (propertyName != null && propertyName.Length > 0) { collection = ObjectProbe.GetMemberValue(parameterObject, propertyName, this.AccessorFactory); } else { collection = parameterObject; } iterate = new IterateContext(collection); ctx.AddAttribute(tag, iterate); } if (iterate != null && iterate.HasNext) { return(BaseTagHandler.INCLUDE_BODY); } else { return(BaseTagHandler.SKIP_BODY); } }
public override int DoStartFragment(SqlTagContext ctx, SqlTag tag, object parameterObject) { IterateContext attribute = (IterateContext)ctx.GetAttribute(tag); if (attribute == null) { object obj2; string property = ((BaseTag)tag).Property; if ((property != null) && (property.Length > 0)) { obj2 = ObjectProbe.GetMemberValue(parameterObject, property, base.AccessorFactory); } else { obj2 = parameterObject; } attribute = new IterateContext(obj2); ctx.AddAttribute(tag, attribute); } if ((attribute != null) && attribute.HasNext) { return(1); } return(0); }
/// <summary> /// /// </summary> /// <param name="ctx"></param> /// <param name="tag"></param> /// <param name="parameterObject"></param> /// <returns></returns> public override int DoStartFragment(SqlTagContext ctx, SqlTag tag, object parameterObject) { IterateContext iterate = (IterateContext) ctx.GetAttribute(tag); if (iterate == null) { string propertyName = ((BaseTag)tag).Property; object collection; if (propertyName != null && propertyName.Length>0) { collection = ObjectProbe.GetMemberValue(parameterObject, propertyName, this.AccessorFactory); } else { collection = parameterObject; } iterate = new IterateContext(collection); ctx.AddAttribute(tag, iterate); } if (iterate != null && iterate.HasNext) { return BaseTagHandler.INCLUDE_BODY; } else { return BaseTagHandler.SKIP_BODY; } }