public void Extend_Existing_ViewItemMap(string platformName, PredefinedMap predefinedMap) { var platform = GetPlatform(platformName); var mapPropertyName = predefinedMap.IsRepositoryItem()?ViewItemService.RepositoryItemsMapName:ViewItemService.PropertyEditorControlMapName; InitializeMapperService(nameof(Extend_Existing_ViewItemMap), platform); using (var module = new[] { predefinedMap }.Extend()){ module.ApplicationModulesManager .FirstAsync() .SelectMany(_ => _.manager.ExtendMap(predefinedMap)) .Subscribe(_ => { _.extenders.Add(_.targetInterface, typeof(IModelPredefinedMapExtension)); }); using (var application = DefaultModelMapperModule(nameof(Extend_Existing_ViewItemMap), platform, module).Application){ var nodeByPath = application.Model.GetNodeByPath(MMDetailViewTestItemNodePath); nodeByPath.ShouldNotBeNull(); var listNode = nodeByPath.GetNode(mapPropertyName); listNode.ShouldNotBeNull(); var baseType = listNode.ModelListItemType(); var modelType = baseType.ToTypeInfo().Descendants.First().Type; (listNode.AddNode(modelType) is IModelPredefinedMapExtension).ShouldBeTrue(); } } }
public static Assembly Assembly(this PredefinedMap predefinedMap) { Assembly assembly = null; if (new[] { PredefinedMap.AdvBandedGridView, PredefinedMap.BandedGridColumn, PredefinedMap.GridView, PredefinedMap.GridColumn, PredefinedMap.LayoutView, PredefinedMap.LayoutViewColumn }.Contains(predefinedMap)) { assembly = typeof(GridView).Assembly; } else if (new[] { PredefinedMap.RepositoryFieldPicker, PredefinedMap.RepositoryItemRtfEditEx, PredefinedMap.RepositoryItemLookupEdit, PredefinedMap.RepositoryItemObjectEdit, PredefinedMap.RepositoryItemPopupExpressionEdit, PredefinedMap.RepositoryItemPopupCriteriaEdit, PredefinedMap.RepositoryItemProtectedContentTextEdit }.Contains(predefinedMap) || predefinedMap == PredefinedMap.XafLayoutControl) { assembly = typeof(SystemWindowsFormsModule).Assembly; } else if (predefinedMap.IsRepositoryItem()) { assembly = typeof(RepositoryItem).Assembly; } else if (predefinedMap == PredefinedMap.SplitContainerControl) { assembly = typeof(SplitContainerControl).Assembly; } else if (predefinedMap == PredefinedMap.RichEditControl) { assembly = typeof(RichEditControl).Assembly; } else if (predefinedMap == PredefinedMap.LabelControl) { assembly = typeof(LabelControl).Assembly; } else if (new[] { PredefinedMap.ASPxUploadControl, PredefinedMap.ASPxPopupControl, PredefinedMap.ASPxDateEdit, PredefinedMap.ASPxHyperLink, PredefinedMap.ASPxSpinEdit, PredefinedMap.ASPxTokenBox, PredefinedMap.ASPxComboBox }.Any(map => map == predefinedMap)) { assembly = typeof(ASPxComboBox).Assembly; } else if (new[] { PredefinedMap.ASPxLookupDropDownEdit, PredefinedMap.ASPxLookupFindEdit }.Any(map => map == predefinedMap)) { assembly = typeof(ASPxLookupDropDownEdit).Assembly; } else if (new[] { PredefinedMap.DashboardDesigner, PredefinedMap.DashboardViewer }.Any(map => map == predefinedMap)) { assembly = typeof(DashboardDesigner).Assembly; } else if (new[] { PredefinedMap.ASPxDashboard }.Any(map => map == predefinedMap)) { assembly = typeof(ASPxDashboard).Assembly; } else if (new[] { PredefinedMap.PivotGridControl, PredefinedMap.PivotGridField }.Contains(predefinedMap)) { assembly = typeof(PivotGridControl).Assembly; } else if (predefinedMap == PredefinedMap.ChartControl || predefinedMap.IsChartControlDiagram()) { assembly = typeof(ChartControl).Assembly; } else if (predefinedMap == PredefinedMap.SchedulerControl) { assembly = typeof(SchedulerControl).Assembly; } else if (predefinedMap == PredefinedMap.ASPxHtmlEditor) { assembly = typeof(ASPxHtmlEditor).Assembly; } else if (predefinedMap == PredefinedMap.ASPxScheduler) { assembly = typeof(ASPxScheduler).Assembly; } else if (new[] { PredefinedMap.TreeList, PredefinedMap.TreeListColumn }.Any(map => map == predefinedMap)) { assembly = typeof(TreeList).Assembly; } if (assembly == null) { throw new NotImplementedException(predefinedMap.ToString()); } return(assembly); }