コード例 #1
0
        public static async Task AddMetadataAsync(this List <Post> posts, IMetadataService metadataService)
        {
            var meta = await metadataService.GetAsync(posts.Select(s => s.Id));

            posts.ForEach(p => p.PostMeta = meta.Where(w => w.PostId == p.Id).ToList());

            //foreach (var post in posts)
            //{
            //    post.PostMeta = meta.Where(w => w.PostId == post.Id).ToList();
            //}
        }
コード例 #2
0
 public static async Task AddMetadataAsync(this Post post, IMetadataService metadataService)
 => post.PostMeta = await metadataService.GetAsync(post.Id);