Thanks for posting your question in the Microsoft Q&A forum.
Here's an example query that demonstrates how to achieve this:
var result = await _userDetails.Table
.GroupBy(x => x.userId)
.Select(x => new
{
UserId = x.Key,
FirstName = x.FirstOrDefault(item => item.Key == "FirstName").Value ?? "",
LastName = x.FirstOrDefault(item => item.Key == "LastName").Value ?? "",
Phone = x.FirstOrDefault(item => item.Key == "Phone").Value ?? ""
})
.ToDictionaryAsync(x => x.UserId, x => new
{
FirstName = x.FirstName,
LastName = x.LastName,
Phone = x.Phone
});
Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful