/// <summary> /// Creates <see cref="Resource"/> out of <paramref name="collection"/> embeding its content as a nested resources. /// </summary> public static Resource WrapUsing <TCollection, TContent>( this TCollection collection, CollectionWrapPolicy <TCollection, TContent> policy, IUrlHelper urlHelper) where TCollection : IEnumerable <TContent> { var resource = collection .WrapUsing( policy.CollectionPolicy, urlHelper); var nestedResources = collection .WrapUsing( policy.ContentPolicy, urlHelper); foreach (var nestedResource in nestedResources) { resource.Embed(nestedResource); } return (resource); }
/// <summary> /// Creates <see cref="Resource"/> out of <paramref name="collection"/> embeding its content as a nested resources ignoring linking rules. /// </summary> public static Resource WrapUsing <TCollection, TContent>( this TCollection collection, CollectionWrapPolicy <TCollection, TContent> policy) where TCollection : IEnumerable <TContent> => collection.WrapUsing(policy, null);