/// <summary> /// Write a nested object to the projected media using the data returned by the "source" /// argument. /// </summary> /// <typeparam name="TChild"></typeparam> /// <param name="source"></param> /// <returns></returns> public ChildProjection <T, TChild> WriteChild <TChild>(Func <IProjectionContext <T>, TChild> source) where TChild : class { var child = new ChildProjection <T, TChild>(_attributeName, source, _parent._formatting); _parent._values.Add(child); return(child); }
/// <summary> /// Project a child node for a complex object represented by a property /// on the subject T type /// </summary> /// <typeparam name="TChild"></typeparam> /// <param name="expression"></param> /// <returns></returns> public ChildProjection <T, TChild> Child <TChild>(Expression <Func <T, TChild> > expression) where TChild : class { var child = new ChildProjection <T, TChild>(expression, _formatting); child.As <IAccessorProjection>().ApplyNaming(_naming); _values.Add(child); return(child); }