public Task Apply(TResult entity, TranslateContext <TInput, TSchema> context) { var inputValue = _inputProperty.Get(context.Input) ?? ValueList.Missing <TValue>(); _property.Set(entity, inputValue); return(TaskUtil.Completed); }
/// <summary> /// Safely returns the <see cref="ValueList{TValue}"/> from the parsed result. /// </summary> /// <param name="result"></param> /// <param name="getter"></param> /// <typeparam name="TCursor"></typeparam> /// <typeparam name="TInput"></typeparam> /// <typeparam name="T"></typeparam> /// <returns></returns> public static ValueList <T> Select <TCursor, TInput, T>(this Result <Cursor <TCursor>, TInput> result, Func <TInput, ValueList <T> > getter) { if (result == null || !result.HasResult) { return(ValueList.Missing <T>()); } return(getter(result.Result) ?? ValueList.Missing <T>()); }
/// <summary> /// Safely returns the <see cref="Value{TValue}"/> from a complex object. /// </summary> /// <param name="source"></param> /// <param name="getter"></param> /// <typeparam name="TSegment"></typeparam> /// <typeparam name="T"></typeparam> /// <returns></returns> public static ValueList <T> Select <TSegment, T>(this Segment <TSegment> source, Func <TSegment, ValueList <T> > getter) where TSegment : X12Segment { if (source == null || !source.HasValue) { return(ValueList.Missing <T>()); } return(getter(source.Value) ?? ValueList.Missing <T>()); }
public Task Apply(TEntity entity, TranslateContext <TInput, TSchema> context) { var existing = _readProperty.Get(entity); if (existing == null) { _property.Set(entity, ValueList.Missing <TPropertyEntity>()); } return(TaskUtil.Completed); }
/// <summary> /// Safely returns the <see cref="Value{TValue}"/> from a complex object. /// </summary> /// <param name="source"></param> /// <param name="getter"></param> /// <typeparam name="TEntity"></typeparam> /// <typeparam name="T"></typeparam> /// <returns></returns> public static ValueList <T> Select <TEntity, T>(this Entity <TEntity> source, Func <TEntity, ValueList <T> > getter) where TEntity : Entity { Debug.Assert(source != null); if (source == null || !source.HasValue) { return(ValueList.Missing <T>()); } return(getter(source.Value) ?? ValueList.Missing <T>()); }