✅ Why ins't this EF Core query being evaluated client-side?
Currently, I have this query:
In the query above, in the
C#
var board = Database.KanbanBoards
.Where(k => k.OwnerUserId == AuthUser.OwningId && k.Id == boardId)
.Select(k => new
{
Data =
Database.KanbanColumns
.Where(c => c.ParentBoardId == k.Id)
.OrderBy(c => c.Order)
.Select(c => new
{
column = new
{
c.Id,
c.Color,
c.Label
},
cards = Database.KanbanCards
.Where(a => a.ParentColumnId == c.Id)
.OrderBy(a => a.Order)
.AsEnumerable() // <!--- run the rest on client side
.Select(a => new
{
a.Id,
Title = a.CardTitle,
Info = new
{
a.Value,
a.Temperature,
AssociatedUsers = a.AssociatedUsers
.Select(n => AdapterCacheUnit.FetchUser(n)) // <!-- client side function
.Where(n => n != null)
.Select(n => new
{
n!.UniqueId,
n.UserName
})
}
})
})
.ToArray()
})
.FirstOrDefault();C#
var board = Database.KanbanBoards
.Where(k => k.OwnerUserId == AuthUser.OwningId && k.Id == boardId)
.Select(k => new
{
Data =
Database.KanbanColumns
.Where(c => c.ParentBoardId == k.Id)
.OrderBy(c => c.Order)
.Select(c => new
{
column = new
{
c.Id,
c.Color,
c.Label
},
cards = Database.KanbanCards
.Where(a => a.ParentColumnId == c.Id)
.OrderBy(a => a.Order)
.AsEnumerable() // <!--- run the rest on client side
.Select(a => new
{
a.Id,
Title = a.CardTitle,
Info = new
{
a.Value,
a.Temperature,
AssociatedUsers = a.AssociatedUsers
.Select(n => AdapterCacheUnit.FetchUser(n)) // <!-- client side function
.Where(n => n != null)
.Select(n => new
{
n!.UniqueId,
n.UserName
})
}
})
})
.ToArray()
})
.FirstOrDefault();In the query above, in the
Database.KanbanCardsDatabase.KanbanCards sub-query I make the rest of the query client-side to transform the "a.AssociatedUsers" column into other information. This is an JSON column.