I try to get DomainCollectionView, but Total Count doesn't include in query:
public DomainCollectionView<sys_log> collView
{
get { return (DomainCollectionView<sys_log>)this.GetValue(collViewProperty); }
set
{
this.SetValue(collViewProperty, value);
}
}
public static DependencyProperty collViewProperty = DependencyProperty.Register(
"collView", typeof(DomainCollectionView<sys_log>), typeof(Journal), new PropertyMetadata(null));
this._source = this.maindatacontext.sys_logs;
this._loader = new DomainCollectionViewLoader<sys_log>(this.LoadEntities, this.mdcloaded);
this._view = new DomainCollectionView<sys_log>(this._loader, this._source);
private LoadOperation<sys_log> LoadEntities()
{
EntityQuery<sys_log> temp = mdc.GetSys_logQuery().OrderBy(order => order.Id).Where(c => c.date > DateFrom.SelectedDate.Value && c.date < DateTo.SelectedDate.Value.AddDays(1).AddTicks(-1)).SortAndPageBy(this._view);
temp.IncludeTotalCount = true;
return mdc.Load(temp);
}
void mdcloaded(LoadOperation<Web.sys_log> t)
{
this.collView = _view;
//but this _view.TotalItemCount = -1
dataGrid1.UpdateLayout();
}
dataGrid1 has ItemSource = collView. How I can set TotalItemCount or include it in query?
You need to override the Count method of your DomainService to get the total count of entities of the query.
public class MyDomainService : DomainService{
protected override int Count<T>(IQueryable<T> query) {
return query.Count();
}
}