protected virtual LogicalView CreateSurrounderView(LogicalView mainView, SurrounderBlock surrounderBlock) { var surrounderType = surrounderBlock.SurrounderType; //相反的关系类型 RelationView reverseRelation = null; if (surrounderType == ConditionBlock.Type) { reverseRelation = new RelationView(QueryLogicalView.ResultSurrounderType, mainView); } else if (surrounderType == NavigationBlock.Type) { reverseRelation = new RelationView(QueryLogicalView.ResultSurrounderType, mainView); } LogicalView surrounderView = this._viewFactory.CreateView(surrounderBlock); this.CreateCommandsUI(surrounderView, surrounderBlock); //直接使用 surrounderType 作为关系的类型,把 surrounderView 添加到 mainView 的关系。 RelationView relation = null; if (surrounderBlock.RelationViewType != null) { relation = Activator.CreateInstance( surrounderBlock.RelationViewType, surrounderType, surrounderView ) as RelationView; } else { relation = new RelationView(surrounderType, surrounderView); } mainView.Relations.Add(relation); //相反的关系设置 reverseRelation = reverseRelation ?? new RelationView(SurrounderBlock.TypeOwner, mainView); surrounderView.Relations.Add(reverseRelation); return(surrounderView); }
protected virtual LogicalView CreateSurrounderView(LogicalView mainView, SurrounderBlock surrounderBlock) { var surrounderType = surrounderBlock.SurrounderType; //相反的关系类型 RelationView reverseRelation = null; if (surrounderType == ConditionBlock.Type) { reverseRelation = new RelationView(QueryLogicalView.ResultSurrounderType, mainView); } else if (surrounderType == NavigationBlock.Type) { reverseRelation = new RelationView(QueryLogicalView.ResultSurrounderType, mainView); } LogicalView surrounderView = this._viewFactory.CreateView(surrounderBlock); this.CreateCommandsUI(surrounderView, surrounderBlock); //直接使用 surrounderType 作为关系的类型,把 surrounderView 添加到 mainView 的关系。 RelationView relation = null; if (surrounderBlock.RelationViewType != null) { relation = Activator.CreateInstance( surrounderBlock.RelationViewType, surrounderType, surrounderView ) as RelationView; } else { relation = new RelationView(surrounderType, surrounderView); } mainView.Relations.Add(relation); //相反的关系设置 reverseRelation = reverseRelation ?? new RelationView(SurrounderBlock.TypeOwner, mainView); surrounderView.Relations.Add(reverseRelation); return surrounderView; }