I create a VirtualQueryableCollectionView using the following method, the SourceCollection of the view is empty. Is there any way to force an initial load?
public
VirtualQueryableCollectionView GetVirtualQueryableCollectionView(
int
loadsize,
List<String> includes, Func<T,
bool
> whereClause,
Func<T, Object> orderBy,
bool
orderByIsDesc =
false
,
Func<T, Object> thenBy =
null
,
bool
thenByIsDesc =
false
)
{
ObjectQuery<T> q = Query(CreateContext());
if
(includes !=
null
)
{
foreach
(var include
in
includes)
{
q = q.Include(include);
}
}
if
(whereClause !=
null
)
{
if
(orderBy !=
null
)
{
if
(orderByIsDesc)
{
if
(thenBy !=
null
)
{
if
(thenByIsDesc)
{
q.Where(whereClause).OrderByDescending(orderBy).ThenByDescending(thenBy);
}
else
{
q.Where(whereClause).OrderByDescending(orderBy).ThenBy(thenBy);
}
}
else
{
q.Where(whereClause).OrderByDescending(orderBy);
}
}
else
{
if
(thenBy !=
null
)
{
if
(thenByIsDesc)
{
q.Where(whereClause).OrderBy(orderBy).ThenByDescending(thenBy);
}
else
{
q.Where(whereClause).OrderBy(orderBy).ThenBy(thenBy);
}
}
else
{
q.Where(whereClause).OrderBy(orderBy);
}
}
}
else
{
q.Where(whereClause);
}
}
else
if
(orderBy !=
null
)
{
if
(orderByIsDesc)
{
if
(thenBy !=
null
)
{
if
(thenByIsDesc)
{
q.OrderByDescending(orderBy).ThenByDescending(thenBy);
}
else
{
q.OrderByDescending(orderBy).ThenBy(thenBy);
}
}
else
{
q.OrderByDescending(orderBy);
}
}
else
{
if
(thenBy !=
null
)
{
if
(thenByIsDesc)
{
q.OrderBy(orderBy).ThenByDescending(thenBy);
}
else
{
q.OrderBy(orderBy).ThenBy(thenBy);
}
}
else
{
q.OrderBy(orderBy);
}
}
}
var view =
new
VirtualQueryableCollectionView(q)
{
LoadSize = loadsize
};
return
view;
}
​