/// <summary> /// 执行转换 /// </summary> /// <param name="context">转换上下文</param> /// <returns></returns> public override IEnumerable <KeyValuePair <string, string> > Invoke(ConvertContext context) { if (context.Data == null) { return(context.ToKeyValuePairs()); } return(this.Next.Invoke(context)); }
/// <summary> /// 执行转换 /// </summary> /// <param name="context">转换上下文</param> /// <returns></returns> public sealed override IEnumerable <KeyValuePair <string, string> > Invoke(ConvertContext context) { if (this.IsSupported(context.DataType) == true) { return(context.ToKeyValuePairs()); } return(this.Next.Invoke(context)); }
/// <summary> /// 执行转换 /// </summary> /// <param name="context">转换上下文</param> /// <returns></returns> public override IEnumerable <KeyValuePair <string, string> > Invoke(ConvertContext context) { var reader = KeyValuePairReader.GetReader(context.DataType); if (reader == null) { return(this.Next.Invoke(context)); } var key = reader.GetKey(context.Data).ToString(); var value = reader.GetValue(context.Data); var ctx = new ConvertContext(key, value, context.Depths, context.Options); return(ctx.ToKeyValuePairs()); }