/// <summary> /// 执行查询操作。 /// <remarks>可能执行本地查询,也可能是远程查询。</remarks> /// </summary> /// <param name="resultView"></param> private void FireQuery(LogicalView resultView) { var args = new QueryEventArgs { ResultView = resultView }; this.OnQuerying(args); //如果是本地查询模式,则尝试为 ListLogicalView 进行过滤。 var criteria = this.Current; if (criteria.CanLocalFilter) { var listView = resultView as ListLogicalView; if (listView != null) { listView.Filter = criteria.LocalFilter; this.OnQueryCompleted(args); return; } } //需要复制一个查询对象,这样可以保存下当前的查询值, //否则会造成 ReloadDataAsync 方法查询时不是使用当前的这些值来查询。 var queryCriteria = Entity.New(this.EntityType); queryCriteria.Clone(this.Current, CloneOptions.NewComposition()); //导航面板的查询使用隐式查询。 resultView.DataLoader.LoadDataAsync( () => RF.Find(resultView.EntityType).GetBy(queryCriteria), () => this.OnQueryCompleted(args) ); }
protected virtual void OnQueryCompleted(QueryEventArgs e) { var handler = this.QueryCompleted; if (handler != null) { handler(this, e); } }
protected virtual void OnQuerying(QueryEventArgs e) { var handler = this.Querying; if (handler != null) handler(this, e); }