/// <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) ); }
public void Execute() { var currentObject = this._currentView.Current as Entity; //拷贝一个新的对象 var newObject = this.CopyObject(currentObject, null, true, CloneOptions.NewComposition()); this._currentView.RefreshControl(); this._currentView.Current = newObject; }
/// <summary> /// 保存实体归档 /// </summary> /// <param name="repository">实体仓储</param> /// <param name="entitiesToMigrate">实体集合</param> private void BackupToHistory(IRepository repository, EntityList entitiesToMigrate) { var newList = repository.NewList(); newList.Clone(entitiesToMigrate, CloneOptions.NewComposition()); using (RdbDataProvider.RedirectDbSetting(_orignalDataDbSettingName, _backUpDbSettingName)) { this.SaveList(repository, newList); } }
/// <summary> /// 保存实体归档 /// </summary> /// <param name="repository">实体仓储</param> /// <param name="entitiesToMigrate">实体集合</param> private void BackupToHistory(IRepository repository, EntityList entitiesToMigrate) { var options = CloneOptions.NewComposition(); options.Actions |= CloneActions.IdProperty;//Id 也需要拷贝。 options.Method = CloneValueMethod.LoadProperty; var newList = repository.NewList(); newList.Clone(entitiesToMigrate, options); using (RdbDataProvider.RedirectDbSetting(_orignalDataDbSettingName, _backUpDbSettingName)) { this.SaveList(repository, newList); } }